use of com.palantir.atlasdb.table.description.Schema in project atlasdb by palantir.
the class CheckAndSetSchema method generateSchema.
private static Schema generateSchema() {
Schema schema = new Schema(CheckAndSetSchema.class.getSimpleName(), CheckAndSetSchema.class.getPackage().getName() + ".generated", Namespace.DEFAULT_NAMESPACE, OptionalType.JAVA8);
schema.addTableDefinition(CAS_TABLE, new TableDefinition() {
{
allSafeForLoggingByDefault();
rowName();
rowComponent("id", ValueType.FIXED_LONG);
columns();
column(VALUES_COLUMN, "v", ValueType.FIXED_LONG);
}
});
return schema;
}
use of com.palantir.atlasdb.table.description.Schema 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.table.description.Schema in project atlasdb by palantir.
the class StreamTestSchema method generateSchema.
private static Schema generateSchema() {
Schema schema = new Schema("StreamTest", StreamTest.class.getPackage().getName() + ".generated", Namespace.DEFAULT_NAMESPACE, OptionalType.JAVA8);
// stores a mapping from key to streamId
schema.addTableDefinition("lookup", new TableDefinition() {
{
javaTableName("KeyValue");
rowName();
rowComponent("key", ValueType.STRING);
columns();
column("streamId", "s", ValueType.VAR_LONG);
}
});
// test defaults
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder("stream_test", "stream_test", ValueType.VAR_LONG).build());
// test defaults with hashRowComponents
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder("test_hash_components", "test_hash_components", ValueType.VAR_LONG).hashRowComponents().build());
// test all the things!
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder("stream_test_with_hash", "stream_test_with_hash", ValueType.VAR_LONG).inMemoryThreshold(4000).compressBlocksInDb().compressStreamInClient().hashFirstRowComponent().isAppendHeavyAndReadLight().build());
schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder("stream_test_max_mem", "stream_test_max_mem", ValueType.VAR_LONG).inMemoryThreshold(StreamStoreDefinition.MAX_IN_MEMORY_THRESHOLD).build());
return schema;
}
use of com.palantir.atlasdb.table.description.Schema in project atlasdb by palantir.
the class IndexTestSchema method generateSchema.
// Table/IndexDefinition syntax
@SuppressWarnings({ "checkstyle:Indentation", "checkstyle:RightCurly" })
private static Schema generateSchema() {
Schema schema = new Schema("IndexTest", IndexTest.class.getPackage().getName() + ".generated", Namespace.DEFAULT_NAMESPACE, OptionalType.JAVA8);
schema.addTableDefinition("data", new TableDefinition() {
{
rowName();
rowComponent("id", ValueType.FIXED_LONG);
columns();
column("value", "v", ValueType.FIXED_LONG);
}
});
schema.addIndexDefinition("index1", new IndexDefinition(IndexType.CELL_REFERENCING) {
{
onTable("data");
rowName();
componentFromColumn("value", ValueType.FIXED_LONG, "value", "_value");
dynamicColumns();
componentFromRow("id", ValueType.FIXED_LONG);
rangeScanAllowed();
}
});
schema.addIndexDefinition("index2", new IndexDefinition(IndexType.CELL_REFERENCING) {
{
onTable("data");
rowName();
componentFromColumn("value", ValueType.FIXED_LONG, "value", "_value");
componentFromRow("id", ValueType.FIXED_LONG);
rangeScanAllowed();
}
});
schema.addIndexDefinition("index3", new IndexDefinition(IndexType.CELL_REFERENCING) {
{
onTable("data");
rowName();
componentFromIterableColumn("value", ValueType.FIXED_LONG, ValueByteOrder.ASCENDING, "value", "ImmutableList.of(_value)");
rangeScanAllowed();
}
});
schema.addIndexDefinition("index4", new IndexDefinition(IndexType.CELL_REFERENCING) {
{
onTable("data");
rowName();
componentFromIterableColumn("value1", ValueType.FIXED_LONG, ValueByteOrder.ASCENDING, "value", "ImmutableList.of(_value)");
componentFromIterableColumn("value2", ValueType.FIXED_LONG, ValueByteOrder.ASCENDING, "value", "ImmutableList.of(_value)");
rangeScanAllowed();
}
});
schema.addTableDefinition("two_columns", new TableDefinition() {
{
rowName();
rowComponent("id", ValueType.FIXED_LONG);
columns();
column("foo", "f", ValueType.FIXED_LONG);
column("bar", "b", ValueType.FIXED_LONG);
}
});
schema.addIndexDefinition("foo_to_id", new IndexDefinition(IndexType.CELL_REFERENCING) {
{
onTable("two_columns");
rowName();
hashFirstRowComponent();
componentFromColumn("foo", ValueType.FIXED_LONG, "foo", "_value");
dynamicColumns();
componentFromRow("id", ValueType.FIXED_LONG);
}
});
schema.addIndexDefinition("foo_to_id_cond", new IndexDefinition(IndexType.CELL_REFERENCING) {
{
onTable("two_columns");
onCondition("foo", "_value > 1");
rowName();
componentFromColumn("foo", ValueType.FIXED_LONG, "foo", "_value");
dynamicColumns();
componentFromRow("id", ValueType.FIXED_LONG);
}
});
return schema;
}
use of com.palantir.atlasdb.table.description.Schema in project atlasdb by palantir.
the class GeneralTaskCheckpointer method getSchema.
@SuppressWarnings({ "checkstyle:Indentation", "checkstyle:RightCurly" })
private Schema getSchema() {
Schema schema = new Schema(checkpointTable.getNamespace());
schema.addTableDefinition(checkpointTable.getTablename(), new TableDefinition() {
{
rowName();
rowComponent("table_name", ValueType.VAR_STRING);
rowComponent("range_id", ValueType.VAR_LONG);
columns();
column("start", SHORT_COLUMN_NAME, ValueType.BLOB);
rangeScanAllowed();
conflictHandler(ConflictHandler.IGNORE_ALL);
}
});
return schema;
}
Aggregations