use of com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder in project atlasdb by palantir.
the class BlobSchema method generateSchema.
private static Schema generateSchema() {
Schema schema = new Schema(BlobSchema.class.getSimpleName(), BlobSchema.class.getPackage().getName() + ".generated", BLOB_NAMESPACE);
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder("data", "Data", ValueType.VAR_LONG).hashRowComponents().tableNameLogSafety(TableMetadataPersistence.LogSafety.SAFE).build());
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder("hotspottyData", "HotspottyData", ValueType.VAR_SIGNED_LONG).build());
schema.addTableDefinition("auditedData", new TableDefinition() {
{
allSafeForLoggingByDefault();
rowName();
rowComponent("id", ValueType.FIXED_LONG);
columns();
column("data", "d", ValueType.BLOB);
}
});
schema.addCleanupTask("auditedData", () -> (tx, cells) -> {
log.info("Deleted data items: [{}]", UnsafeArg.of("cells", cells));
return false;
});
schema.validate();
return schema;
}
use of com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder in project atlasdb by palantir.
the class SchemaTest method streamStoreMetadataGeneratedCorrectlyForSimpleStreamStore.
@Test
public void streamStoreMetadataGeneratedCorrectlyForSimpleStreamStore() {
Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
String shortName = "f";
String longName = "Floccinaucinihilipilification";
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder(shortName, longName, ValueType.VAR_LONG).build());
assertCleanupMetadataCorrectForStreamStore(schema, shortName, 0, ValueType.VAR_LONG);
}
use of com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder in project atlasdb by palantir.
the class SchemaTest method streamStoreTablesSupportAdditionalCleanupTasks.
@Test
public void streamStoreTablesSupportAdditionalCleanupTasks() {
Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
String shortName = "l";
String longName = "Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch";
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder(shortName, longName, ValueType.VAR_SIGNED_LONG).hashRowComponents().build());
schema.addCleanupTask(StreamTableType.HASH.getTableName(shortName), () -> (cells, tx) -> false);
schema.addCleanupTask(StreamTableType.INDEX.getTableName(shortName), () -> (cells, tx) -> false);
assertCleanupMetadataInSchemaSatisfies(schema, StreamTableType.VALUE.getTableName(shortName), NULL_CLEANUP_METADATA_ASSERTION);
assertCleanupMetadataInSchemaSatisfies(schema, StreamTableType.HASH.getTableName(shortName), ARBITRARY_CLEANUP_METADATA_ASSERTION);
assertCleanupMetadataInSchemaSatisfies(schema, StreamTableType.METADATA.getTableName(shortName), getStreamStoreMetadataAssertion(2, ValueType.VAR_SIGNED_LONG));
assertCleanupMetadataInSchemaSatisfies(schema, StreamTableType.INDEX.getTableName(shortName), ARBITRARY_CLEANUP_METADATA_ASSERTION);
}
use of com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder in project atlasdb by palantir.
the class SchemaTest method streamStoreMetadataGeneratedCorrectlyForStreamStoreWithHashRowComponents.
@Test
public void streamStoreMetadataGeneratedCorrectlyForStreamStoreWithHashRowComponents() {
Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
String shortName = "p";
String longName = "Pneumonoultramicroscopicsilicovolcanoconiosis";
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder(shortName, longName, ValueType.FIXED_LONG_LITTLE_ENDIAN).hashRowComponents().build());
assertCleanupMetadataCorrectForStreamStore(schema, shortName, 2, ValueType.FIXED_LONG_LITTLE_ENDIAN);
}
use of com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder in project atlasdb by palantir.
the class SchemaTest method streamStoreMetadataGeneratedCorrectlyForStreamStoreWithHashFirstRowComponent.
@Test
public void streamStoreMetadataGeneratedCorrectlyForStreamStoreWithHashFirstRowComponent() {
Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
String shortName = "a";
String longName = "Antidisestablishmentarianism";
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder(shortName, longName, ValueType.FIXED_LONG).hashFirstRowComponent().build());
assertCleanupMetadataCorrectForStreamStore(schema, shortName, 1, ValueType.FIXED_LONG);
}
Aggregations