/** * @see #fromFilename(File directory, String name) * @param filename The SSTable filename * @return Descriptor of the SSTable initialized from filename */ public static Descriptor fromFilename(String filename) { return fromFilename(filename, false); }
@Override public String toString() { return baseFilename(); }
public String name() { return descriptor.toString(); }
private String getTempSSTablePath(File directory, Descriptor.Version version) { Descriptor desc = new Descriptor(version, directory, keyspace.getName(), name, fileIndexGenerator.incrementAndGet(), Descriptor.Type.TEMP); return desc.filenameFor(Component.DATA); }
private void writeMetadata(Descriptor desc, Map<MetadataType, MetadataComponent> components) { File file = new File(desc.filenameFor(Component.STATS)); try (SequentialWriter out = new SequentialWriter(file, writerOption)) { desc.getMetadataSerializer().serialize(components, out, desc.version); out.finish(); } catch (IOException e) { throw new FSWriteError(e, file.getPath()); } }
public boolean equals(Object o) { return !(o == null || !(o instanceof PerSSTableIndexWriter)) && descriptor.equals(((PerSSTableIndexWriter) o).descriptor); } }
public String baseFilename() { StringBuilder buff = new StringBuilder(); buff.append(directory).append(File.separatorChar); appendFileName(buff); return buff.toString(); }
public int hashCode() { return descriptor.hashCode(); }
/** * @param component component to get timestamp. * @return last modified time for given component. 0 if given component does not exist or IO error occurs. */ public long getCreationTimeFor(Component component) { return new File(descriptor.filenameFor(component)).lastModified(); }
/** * Reloads the sstable metadata from disk. * * Called after level is changed on sstable, for example if the sstable is dropped to L0 * * Might be possible to remove in future versions * * @throws IOException */ public void reloadSSTableMetadata() throws IOException { this.sstableMetadata = (StatsMetadata) descriptor.getMetadataSerializer().deserialize(descriptor, MetadataType.STATS); }
private static SSTableReader internalOpen(final Descriptor descriptor, Set<Component> components, CFMetaData metadata, Long maxDataAge, StatsMetadata sstableMetadata, OpenReason openReason, SerializationHeader header) { Factory readerFactory = descriptor.getFormat().getReaderFactory(); return readerFactory.open(descriptor, components, metadata, maxDataAge, sstableMetadata, openReason, header); }
/** * @param type temporary flag * @return A clone of this descriptor with the given 'temporary' status. */ public Descriptor asType(Type type) { return new Descriptor(version, directory, ksname, cfname, generation, type); }
private String getSSTablePath(File directory, Version version, SSTableFormat.Type format) { Descriptor desc = new Descriptor(version, directory, keyspace.getName(), name, fileIndexGenerator.incrementAndGet(), format, Component.digestFor(BigFormat.latestVersion.uncompressedChecksumType())); return desc.filenameFor(Component.DATA); }
private void writeMetadata(Descriptor desc, Map<MetadataType, MetadataComponent> components) { File file = new File(desc.filenameFor(Component.STATS)); try (SequentialWriter out = new SequentialWriter(file, writerOption)) { desc.getMetadataSerializer().serialize(components, out, desc.version); out.finish(); } catch (IOException e) { throw new FSWriteError(e, file.getPath()); } }
public boolean equals(Object o) { return !(o == null || !(o instanceof PerSSTableIndexWriter)) && descriptor.equals(((PerSSTableIndexWriter) o).descriptor); } }
public String baseFilename() { StringBuilder buff = new StringBuilder(); buff.append(directory).append(File.separatorChar); appendFileName(buff); return buff.toString(); }
public int hashCode() { return descriptor.hashCode(); }
/** * @param component component to get timestamp. * @return last modified time for given component. 0 if given component does not exist or IO error occurs. */ public long getCreationTimeFor(Component component) { return new File(descriptor.filenameFor(component)).lastModified(); }
/** * Reloads the sstable metadata from disk. * * Called after level is changed on sstable, for example if the sstable is dropped to L0 * * Might be possible to remove in future versions * * @throws IOException */ public void reloadSSTableMetadata() throws IOException { this.sstableMetadata = (StatsMetadata) descriptor.getMetadataSerializer().deserialize(descriptor, MetadataType.STATS); }
private static SSTableReader internalOpen(final Descriptor descriptor, Set<Component> components, CFMetaData metadata, Long maxDataAge, StatsMetadata sstableMetadata, OpenReason openReason, SerializationHeader header) { Factory readerFactory = descriptor.getFormat().getReaderFactory(); return readerFactory.open(descriptor, components, metadata, maxDataAge, sstableMetadata, openReason, header); }