Package org.apache.cassandra.io

Examples of org.apache.cassandra.io.SSTableReader


        StorageService.instance().initServer();

        // write a temporary SSTable, but don't register it
        Set<String> content = new HashSet<String>();
        content.add("key");
        SSTableReader sstable = SSTableUtils.writeSSTable(content);
        String tablename = sstable.getTableName();
        String cfname = sstable.getColumnFamilyName();

        // transfer
        Streaming.transferSSTables(LOCAL, Arrays.asList(sstable), tablename);

        // confirm that the SSTable was transferred and registered
View Full Code Here


        ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
        writer.append(partitioner.decorateKey("rowB"), dob);
        dob.reset();
        cfamily.clear();
    
        SSTableReader reader = writer.closeAndOpenReader(0);
       
        // Export to JSON and verify
        File tempJson = File.createTempFile("Standard1", ".json");
        SSTableExport.export(reader, new PrintStream(tempJson.getPath()));
       
View Full Code Here

        ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
        writer.append(partitioner.decorateKey("rowB"), dob);
        dob.reset();
        cfamily.clear();
    
        SSTableReader reader = writer.closeAndOpenReader(0);
       
        // Export to JSON and verify
        File tempJson = File.createTempFile("Super4", ".json");
        SSTableExport.export(reader, new PrintStream(tempJson.getPath()));
       
View Full Code Here

        ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
        writer.append(partitioner.decorateKey("rowA"), dob);
        dob.reset();
        cfamily.clear();
       
        SSTableReader reader = writer.closeAndOpenReader(0);
       
        // Export to JSON and verify
        File tempJson = File.createTempFile("Standard1", ".json");
        SSTableExport.export(reader, new PrintStream(tempJson.getPath()));
       
View Full Code Here

        String jsonUrl = getClass().getClassLoader().getResource("SimpleCF.json").getPath();
        File tempSS = createTemporarySSTable("Keyspace1", "Standard1");
        SSTableImport.importJson(jsonUrl, "Keyspace1", "Standard1", tempSS.getPath());

        // Verify results
        SSTableReader reader = SSTableAccessor.getSSTableReader(tempSS.getPath(), DatabaseDescriptor.getPartitioner());
        NamesQueryFilter qf = new NamesQueryFilter("rowA", new QueryPath("Standard1", null, null), "colAA".getBytes());
        ColumnFamily cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
        assert Arrays.equals(cf.getColumn("colAA".getBytes()).value(), hexToBytes("76616c4141"));
    }
View Full Code Here

        String jsonUrl = getClass().getClassLoader().getResource("SuperCF.json").getPath();
        File tempSS = createTemporarySSTable("Keyspace1", "Super4");
        SSTableImport.importJson(jsonUrl, "Keyspace1", "Super4", tempSS.getPath());
       
        // Verify results
        SSTableReader reader = SSTableAccessor.getSSTableReader(tempSS.getPath(), DatabaseDescriptor.getPartitioner());
        NamesQueryFilter qf = new NamesQueryFilter("rowA", new QueryPath("Super4", null, null), "superA".getBytes());
        ColumnFamily cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
        IColumn superCol = cf.getColumn("superA".getBytes());
        assert Arrays.equals(superCol.getSubColumn("colAA".getBytes()).value(), hexToBytes("76616c75654141"));
    }
View Full Code Here

        {
            String filename = file.getAbsolutePath();
            if (SSTable.deleteIfCompacted(filename))
                continue;

            SSTableReader sstable;
            try
            {
                sstable = SSTableReader.open(filename);
            }
            catch (IOException ex)
View Full Code Here

     *  Find the maximum size file in the list .
     */
    SSTableReader getMaxSizeFile(Iterable<SSTableReader> sstables)
    {
        long maxSize = 0L;
        SSTableReader maxFile = null;
        for (SSTableReader sstable : sstables)
        {
            if (sstable.length() > maxSize)
            {
                maxSize = sstable.length();
View Full Code Here

     * @throws IOException on failure to read/write input/output
     */
    public static void export(String ssTableFile, PrintStream outs, String[] keys, String[] excludes)
    throws IOException
    {
        SSTableReader reader = SSTableReader.open(ssTableFile);
        SSTableScanner scanner = reader.getScanner(INPUT_FILE_BUFFER_SIZE);
        IPartitioner<?> partitioner = DatabaseDescriptor.getPartitioner();   
        Set<String> excludeSet = new HashSet<String>(Arrays.asList(excludes));
        int i = 0;
       
        outs.println("{");
View Full Code Here

     * @param outs PrintStream to write the output to
     * @throws IOException on failure to read/write input/output
     */
    public static void export(String ssTableFile, PrintStream outs, String[] excludes) throws IOException
    {
        SSTableReader reader = SSTableReader.open(ssTableFile);
        export(reader, outs, excludes);
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.io.SSTableReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.