当前位置: 首页>>代码示例>>Java>>正文


Java Component类代码示例

本文整理汇总了Java中org.apache.cassandra.io.sstable.Component的典型用法代码示例。如果您正苦于以下问题:Java Component类的具体用法?Java Component怎么用?Java Component使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Component类属于org.apache.cassandra.io.sstable包,在下文中一共展示了Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserialize

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
public Map<MetadataType, MetadataComponent> deserialize(Descriptor descriptor, EnumSet<MetadataType> types) throws IOException
{
    Map<MetadataType, MetadataComponent> components;
    logger.trace("Load metadata for {}", descriptor);
    String statsFile = descriptor.filenameFor(Component.STATS);

    if (!HadoopFileUtils.exists(statsFile, descriptor.getConfiguration()))
    {
        logger.trace("No sstable stats for {}", descriptor);
        components = Maps.newHashMap();
        components.put(MetadataType.STATS, MetadataCollector.defaultStatsMetadata());
    }
    else
    {
        try (RandomAccessReader r = RandomAccessReader.open(statsFile, descriptor.getConfiguration()))
        {
            components = deserialize(descriptor, r, types);
        }
    }

    return components;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:23,代码来源:MetadataSerializer.java

示例2: flushBf

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
/**
 * Closes the index and bloomfilter, making the public state of this writer valid for consumption.
 */
void flushBf()
{
    if (components.contains(Component.FILTER))
    {
        String path = descriptor.filenameFor(Component.FILTER);

        try (HadoopFileUtils.HadoopFileChannel hos = HadoopFileUtils.newFilesystemChannel(path,
                                                                              descriptor.getConfiguration());
             DataOutputStreamPlus stream = new BufferedDataOutputStreamPlus(hos))
        {
            // bloom filter
            FilterFactory.serialize(bf, stream);
            stream.flush();
            //SyncUtil.sync(hos);
        }
        catch (IOException e)
        {
            logger.info(e.getMessage());
            throw new FSWriteError(e, path);
        }
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:26,代码来源:BigTableWriter.java

示例3: internalOpen

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
/**
 * Open a RowIndexedReader which already has its state initialized (by SSTableWriter).
 */
public static SSTableReader internalOpen(Descriptor desc,
                                  Set<Component> components,
                                  CFMetaData metadata,
                                  FileHandle ifile,
                                  FileHandle dfile,
                                  IndexSummary isummary,
                                  IFilter bf,
                                  long maxDataAge,
                                  StatsMetadata sstableMetadata,
                                  OpenReason openReason,
                                  SerializationHeader header)
{
    assert desc != null && ifile != null && dfile != null && isummary != null && bf != null && sstableMetadata != null;

    SSTableReader reader = internalOpen(desc, components, metadata, maxDataAge, sstableMetadata, openReason, header);

    reader.bf = bf;
    reader.ifile = ifile;
    reader.dfile = dfile;
    reader.indexSummary = isummary;
    reader.setup(true);

    return reader;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:28,代码来源:SSTableReader.java

示例4: getIndexReaders

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
@Override
public Collection<SSTableReader> getIndexReaders() {
    Collection<SSTableReader> readers = new ArrayList<>(sstables.size());
    for (org.apache.cassandra.io.sstable.format.SSTableReader sstable : sstables) {
        try {
            File dataFile = new File(sstable.descriptor.filenameFor(Component.DATA));
            readers.add(new IndexReader(
                    new SSTableStatistics(
                            sstable.descriptor.generation,
                            dataFile.getName(),
                            sstable.uncompressedLength(),
                            sstable.getMinTimestamp(),
                            sstable.getMaxTimestamp(),
                            sstable.getSSTableLevel()),
                    sstable.openIndexReader(),
                    sstable.descriptor.version,
                    sstable.getPartitioner()
            ));
        } catch (Throwable t) {}
    }
    return readers;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:23,代码来源:ColumnFamilyBackend.java

示例5: getDataReaders

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
@Override
public Collection<SSTableReader> getDataReaders(RateLimiter rateLimiter) {
    Collection<SSTableReader> readers = new ArrayList<>(sstables.size());
    for (org.apache.cassandra.io.sstable.format.SSTableReader sstable : sstables) {
        try {
            File dataFile = new File(sstable.descriptor.filenameFor(Component.DATA));
            readers.add(new DataReader(
                    new SSTableStatistics(
                            sstable.descriptor.generation,
                            dataFile.getName(),
                            sstable.uncompressedLength(),
                            sstable.getMinTimestamp(),
                            sstable.getMaxTimestamp(),
                            sstable.getSSTableLevel()),
                    sstable.getScanner(rateLimiter),
                    Util.NOW_SECONDS - sstable.metadata.params.gcGraceSeconds
            ));
        } catch (Throwable t) {}
    }
    return readers;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:22,代码来源:ColumnFamilyBackend.java

示例6: getIndexReaders

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
@Override
public Collection<SSTableReader> getIndexReaders() {
    Collection<SSTableReader> readers = new ArrayList<>(sstables.size());
    for (org.apache.cassandra.io.sstable.SSTableReader sstable : sstables) {
        try {
            File dataFile = new File(sstable.descriptor.filenameFor(Component.DATA));
            readers.add(new IndexReader(
                    new SSTableStatistics(
                            sstable.descriptor.generation,
                            dataFile.getName(),
                            sstable.uncompressedLength(),
                            sstable.getMinTimestamp(),
                            sstable.getMaxTimestamp(),
                            sstable.getSSTableLevel()),
                    sstable.openIndexReader(),
                    sstable.partitioner
            ));
        } catch (Throwable t) {
        }
    }
    return readers;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:23,代码来源:ColumnFamilyBackend.java

示例7: getDataReaders

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
@Override
public Collection<SSTableReader> getDataReaders(RateLimiter rateLimiter) {
    Collection<SSTableReader> readers = new ArrayList<>(sstables.size());
    for (org.apache.cassandra.io.sstable.SSTableReader sstable : sstables) {
        try {
            File dataFile = new File(sstable.descriptor.filenameFor(Component.DATA));
            readers.add(new DataReader(
                    new SSTableStatistics(
                            sstable.descriptor.generation,
                            dataFile.getName(),
                            sstable.uncompressedLength(),
                            sstable.getMinTimestamp(),
                            sstable.getMaxTimestamp(),
                            sstable.getSSTableLevel()),
                    sstable.getScanner(rateLimiter),
                    Util.NOW_SECONDS - sstable.metadata.getGcGraceSeconds()
            ));
        } catch (Throwable t) {
        }
    }
    return readers;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:23,代码来源:ColumnFamilyBackend.java

示例8: getIndexReaders

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
@Override
public Collection<SSTableReader> getIndexReaders() {
    Collection<SSTableReader> readers = new ArrayList<>(sstables.size());
    for (org.apache.cassandra.io.sstable.format.SSTableReader sstable : sstables) {
        try {
            File dataFile = new File(sstable.descriptor.filenameFor(Component.DATA));
            readers.add(new IndexReader(
                    new SSTableStatistics(
                            sstable.descriptor.generation,
                            dataFile.getName(),
                            sstable.uncompressedLength(),
                            sstable.getMinTimestamp(),
                            sstable.getMaxTimestamp(),
                            sstable.getSSTableLevel()),
                    sstable.openIndexReader(),
                    sstable.partitioner
            ));
        } catch (Throwable t) {
        }
    }
    return readers;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:23,代码来源:ColumnFamilyBackend.java

示例9: getDataReaders

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
@Override
public Collection<SSTableReader> getDataReaders(RateLimiter rateLimiter) {
    Collection<SSTableReader> readers = new ArrayList<>(sstables.size());
    for (org.apache.cassandra.io.sstable.format.SSTableReader sstable : sstables) {
        try {
            File dataFile = new File(sstable.descriptor.filenameFor(Component.DATA));
            readers.add(new DataReader(
                    new SSTableStatistics(
                            sstable.descriptor.generation,
                            dataFile.getName(),
                            sstable.uncompressedLength(),
                            sstable.getMinTimestamp(),
                            sstable.getMaxTimestamp(),
                            sstable.getSSTableLevel()),
                    sstable.getScanner(rateLimiter),
                    Util.NOW_SECONDS - sstable.metadata.getGcGraceSeconds()
            ));
        } catch (Throwable t) {
        }
    }
    return readers;
}
 
开发者ID:instaclustr,项目名称:cassandra-sstable-tools,代码行数:23,代码来源:ColumnFamilyBackend.java

示例10: getAndReferenceSSTables

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
public synchronized Refs<SSTableReader> getAndReferenceSSTables(UUID cfId)
{
    Set<SSTableReader> sstables = sstableMap.get(cfId);
    Iterator<SSTableReader> sstableIterator = sstables.iterator();
    ImmutableMap.Builder<SSTableReader, Ref<SSTableReader>> references = ImmutableMap.builder();
    while (sstableIterator.hasNext())
    {
        SSTableReader sstable = sstableIterator.next();
        if (!new File(sstable.descriptor.filenameFor(Component.DATA)).exists())
        {
            sstableIterator.remove();
        }
        else
        {
            Ref<SSTableReader> ref = sstable.tryRef();
            if (ref == null)
                sstableIterator.remove();
            else
                references.put(sstable, ref);
        }
    }
    return new Refs<>(references.build());
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:24,代码来源:ActiveRepairService.java

示例11: MetadataCollector

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
public MetadataCollector(Collection<SSTableReader> sstables, CellNameType columnNameComparator, int level)
{
    this(columnNameComparator);

    replayPosition(ReplayPosition.getReplayPosition(sstables));
    sstableLevel(level);
    // Get the max timestamp of the precompacted sstables
    // and adds generation of live ancestors
    for (SSTableReader sstable : sstables)
    {
        addAncestor(sstable.descriptor.generation);
        for (Integer i : sstable.getAncestors())
            if (new File(sstable.descriptor.withGeneration(i).filenameFor(Component.DATA)).exists())
                addAncestor(i);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:MetadataCollector.java

示例12: deserialize

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
public Map<MetadataType, MetadataComponent> deserialize(Descriptor descriptor, EnumSet<MetadataType> types) throws IOException
{
    Map<MetadataType, MetadataComponent> components;
    logger.debug("Load metadata for {}", descriptor);
    File statsFile = new File(descriptor.filenameFor(Component.STATS));
    if (!statsFile.exists())
    {
        logger.debug("No sstable stats for {}", descriptor);
        components = Maps.newHashMap();
        components.put(MetadataType.STATS, MetadataCollector.defaultStatsMetadata());
    }
    else
    {
        try (RandomAccessReader r = RandomAccessReader.open(statsFile))
        {
            components = deserialize(descriptor, r, types);
        }
    }
    return components;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:21,代码来源:MetadataSerializer.java

示例13: writeFullChecksum

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
public void writeFullChecksum(Descriptor descriptor)
{
    File outFile = new File(descriptor.filenameFor(Component.DIGEST));
    BufferedWriter out = null;
    try
    {
        out = Files.newBufferedWriter(outFile.toPath(), Charsets.UTF_8);
        out.write(String.valueOf(fullChecksum.getValue()));
    }
    catch (IOException e)
    {
        throw new FSWriteError(e, outFile);
    }
    finally
    {
        FileUtils.closeQuietly(out);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:DataIntegrityMetadata.java

示例14: run

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
public void run()
{
    SystemKeyspace.clearSSTableReadMeter(desc.ksname, desc.cfname, desc.generation);

    try
    {
        // If we can't successfully delete the DATA component, set the task to be retried later: see TransactionTidier
        File datafile = new File(desc.filenameFor(Component.DATA));

        delete(datafile);
        // let the remainder be cleaned up by delete
        SSTable.delete(desc, SSTable.discoverComponentsFor(desc));
    }
    catch (Throwable t)
    {
        logger.error("Failed deletion for {}, we'll retry after GC and on server restart", desc);
        failedDeletions.add(this);
        return;
    }

    if (tracker != null && tracker.cfstore != null && !wasNew)
        tracker.cfstore.metric.totalDiskSpaceUsed.dec(sizeOnDisk);

    // release the referent to the parent so that the all transaction files can be released
    parentRef.release();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:27,代码来源:LogTransaction.java

示例15: createColumnFamilyStore

import org.apache.cassandra.io.sstable.Component; //导入依赖的package包/类
public static synchronized ColumnFamilyStore createColumnFamilyStore(Keyspace keyspace,
                                                                     String columnFamily,
                                                                     CFMetaData metadata,
                                                                     boolean loadSSTables)
{
    // get the max generation number, to prevent generation conflicts
    Directories directories = new Directories(metadata, initialDirectories);
    Directories.SSTableLister lister = directories.sstableLister(Directories.OnTxnErr.IGNORE).includeBackups(true);
    List<Integer> generations = new ArrayList<Integer>();
    for (Map.Entry<Descriptor, Set<Component>> entry : lister.list().entrySet())
    {
        Descriptor desc = entry.getKey();
        generations.add(desc.generation);
        if (!desc.isCompatible())
            throw new RuntimeException(String.format("Incompatible SSTable found. Current version %s is unable to read file: %s. Please run upgradesstables.",
                    desc.getFormat().getLatestVersion(), desc));
    }
    Collections.sort(generations);
    int value = (generations.size() > 0) ? (generations.get(generations.size() - 1)) : 0;

    return new ColumnFamilyStore(keyspace, columnFamily, value, metadata, directories, loadSSTables);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:23,代码来源:ColumnFamilyStore.java


注:本文中的org.apache.cassandra.io.sstable.Component类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。