private static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } return components; }
public static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { if (componentType == Component.Type.DIGEST) { if (desc.digestComponent != null && new File(desc.filenameFor(desc.digestComponent)).exists()) components.add(desc.digestComponent); } else { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } } return components; }
public static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { if (componentType == Component.Type.DIGEST) { if (desc.digestComponent != null && new File(desc.filenameFor(desc.digestComponent)).exists()) components.add(desc.digestComponent); } else { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } } return components; }
public static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { if (componentType == Component.Type.DIGEST) { if (desc.digestComponent != null && new File(desc.filenameFor(desc.digestComponent)).exists()) components.add(desc.digestComponent); } else { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } } return components; }
/** * Reads the list of components from the TOC component. * @return set of components found in the TOC */ protected static Set<Component> readTOC(Descriptor descriptor) throws IOException { File tocFile = new File(descriptor.filenameFor(Component.TOC)); List<String> componentNames = Files.readLines(tocFile, Charset.defaultCharset()); Set<Component> components = Sets.newHashSetWithExpectedSize(componentNames.size()); for (String componentName : componentNames) { Component component = new Component(Component.Type.fromRepresentation(componentName), componentName); if (!new File(descriptor.filenameFor(component)).exists()) logger.error("Missing component: {}", descriptor.filenameFor(component)); else components.add(component); } return components; }
/** * Reads the list of components from the TOC component. * @return set of components found in the TOC */ protected static Set<Component> readTOC(Descriptor descriptor) throws IOException { File tocFile = new File(descriptor.filenameFor(Component.TOC)); List<String> componentNames = Files.readLines(tocFile, Charset.defaultCharset()); Set<Component> components = Sets.newHashSetWithExpectedSize(componentNames.size()); for (String componentName : componentNames) { Component component = new Component(Component.Type.fromRepresentation(componentName), componentName); if (!new File(descriptor.filenameFor(component)).exists()) logger.error("Missing component: {}", descriptor.filenameFor(component)); else components.add(component); } return components; }
public static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { if (componentType == Component.Type.DIGEST) { if (desc.digestComponent != null && new File(desc.filenameFor(desc.digestComponent)).exists()) components.add(desc.digestComponent); } else { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } } return components; }
case SUMMARY: component = Component.SUMMARY; break; case TOC: component = Component.TOC; break; case SECONDARY_INDEX: component = new Component(Type.SECONDARY_INDEX, path.right); break; case CUSTOM: component = new Component(Type.CUSTOM, path.right); break; default: throw new IllegalStateException();
case SUMMARY: component = Component.SUMMARY; break; case TOC: component = Component.TOC; break; case SECONDARY_INDEX: component = new Component(Type.SECONDARY_INDEX, path.right); break; case CUSTOM: component = new Component(Type.CUSTOM, path.right); break; default: throw new IllegalStateException();
case SUMMARY: component = Component.SUMMARY; break; case TOC: component = Component.TOC; break; case SECONDARY_INDEX: component = new Component(Type.SECONDARY_INDEX, path.right); break; case CUSTOM: component = new Component(Type.CUSTOM, path.right); break; default: throw new IllegalStateException();
/** * Reads the list of components from the TOC component. * @return set of components found in the TOC */ protected static Set<Component> readTOC(Descriptor descriptor) throws IOException { File tocFile = new File(descriptor.filenameFor(Component.TOC)); List<String> componentNames = Files.readLines(tocFile, Charset.defaultCharset()); Set<Component> components = Sets.newHashSetWithExpectedSize(componentNames.size()); for (String componentName : componentNames) { Component component = new Component(Component.Type.fromRepresentation(componentName), componentName); if (!new File(descriptor.filenameFor(component)).exists()) logger.error("Missing component: {}", descriptor.filenameFor(component)); else components.add(component); } return components; }
/** * Reads the list of components from the TOC component. * @return set of components found in the TOC */ protected static Set<Component> readTOC(Descriptor descriptor) throws IOException { File tocFile = new File(descriptor.filenameFor(Component.TOC)); List<String> componentNames = Files.readLines(tocFile, Charset.defaultCharset()); Set<Component> components = Sets.newHashSetWithExpectedSize(componentNames.size()); for (String componentName : componentNames) { Component component = new Component(Component.Type.fromRepresentation(componentName), componentName); if (!new File(descriptor.filenameFor(component)).exists()) logger.error("Missing component: {}", descriptor.filenameFor(component)); else components.add(component); } return components; }
public ColumnIndex(AbstractType<?> keyValidator, ColumnDefinition column, IndexMetadata metadata) { this.keyValidator = keyValidator; this.column = column; this.config = metadata == null ? Optional.empty() : Optional.of(metadata); this.mode = IndexMode.getMode(column, config); this.memtable = new AtomicReference<>(new IndexMemtable(this)); this.tracker = new DataTracker(keyValidator, this); this.component = new Component(Component.Type.SECONDARY_INDEX, String.format(FILE_NAME_FORMAT, getIndexName())); this.isTokenized = getAnalyzer().isTokenizing(); }
public ColumnIndex(AbstractType<?> keyValidator, ColumnDefinition column, IndexMetadata metadata) { this.keyValidator = keyValidator; this.column = column; this.config = metadata == null ? Optional.empty() : Optional.of(metadata); this.mode = IndexMode.getMode(column, config); this.memtable = new AtomicReference<>(new IndexMemtable(this)); this.tracker = new DataTracker(keyValidator, this); this.component = new Component(Component.Type.SECONDARY_INDEX, String.format(FILE_NAME_FORMAT, getIndexName())); this.isTokenized = getAnalyzer().isTokenizing(); }
public ColumnIndex(AbstractType<?> keyValidator, ColumnDefinition column, IndexMetadata metadata) { this.keyValidator = keyValidator; this.column = column; this.config = metadata == null ? Optional.empty() : Optional.of(metadata); this.mode = IndexMode.getMode(column, config); this.memtable = new AtomicReference<>(new IndexMemtable(this)); this.tracker = new DataTracker(keyValidator, this); this.component = new Component(Component.Type.SECONDARY_INDEX, String.format(FILE_NAME_FORMAT, getIndexName())); this.isTokenized = getAnalyzer().isTokenizing(); }
/** * Filename of the form "<ksname>/<cfname>-[tmp-][<version>-]<gen>-<component>", * @return A Descriptor for the SSTable, and a Component for this particular file. * TODO move descriptor into Component field */ public static Pair<Descriptor,Component> fromFilename(File directory, String name) { Pair<Descriptor,String> path = Descriptor.fromFilename(directory, name); // parse the component suffix Type type = Type.fromRepresentation(path.right); // build (or retrieve singleton for) the component object Component component; switch(type) { case DATA: component = Component.DATA; break; case PRIMARY_INDEX: component = Component.PRIMARY_INDEX; break; case FILTER: component = Component.FILTER; break; case COMPRESSION_INFO: component = Component.COMPRESSION_INFO; break; case STATS: component = Component.STATS; break; case DIGEST: component = Component.DIGEST; break; case CRC: component = Component.CRC; break; case SUMMARY: component = Component.SUMMARY; break; case TOC: component = Component.TOC; break; case CUSTOM: component = new Component(Type.CUSTOM, path.right); break; default: throw new IllegalStateException(); } return Pair.create(path.left, component); }
/** * Reads the list of components from the TOC component. * @return set of components found in the TOC */ protected static Set<Component> readTOC(Descriptor descriptor) throws IOException { File tocFile = new File(descriptor.filenameFor(Component.TOC)); //List<String> componentNames = Files.readLines(tocFile, Charset.defaultCharset()); List<String> componentNames = readLines(tocFile); Set<Component> components = Sets.newHashSetWithExpectedSize(componentNames.size()); for (String componentName : componentNames) { Component component = new Component(Component.Type.fromRepresentation(componentName), componentName); try(ChannelProxy proxy = ChannelProxy.getInstance(descriptor.filenameFor(component))) { if (!proxy.exists()) logger.error("Missing component: {}", descriptor.filenameFor(component)); else components.add(component); } } return components; }