Search in sources :

Example 1 with Schema

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;
}
Also used : AtlasSchema(com.palantir.atlasdb.schema.AtlasSchema) Schema(com.palantir.atlasdb.table.description.Schema) TableDefinition(com.palantir.atlasdb.table.description.TableDefinition)

Example 2 with 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;
}
Also used : StreamStoreDefinitionBuilder(com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder) AtlasSchema(com.palantir.atlasdb.schema.AtlasSchema) Schema(com.palantir.atlasdb.table.description.Schema) TableDefinition(com.palantir.atlasdb.table.description.TableDefinition)

Example 3 with 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;
}
Also used : AtlasSchema(com.palantir.atlasdb.schema.AtlasSchema) Schema(com.palantir.atlasdb.table.description.Schema) TableDefinition(com.palantir.atlasdb.table.description.TableDefinition)

Example 4 with 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;
}
Also used : IndexDefinition(com.palantir.atlasdb.table.description.IndexDefinition) AtlasSchema(com.palantir.atlasdb.schema.AtlasSchema) Schema(com.palantir.atlasdb.table.description.Schema) TableDefinition(com.palantir.atlasdb.table.description.TableDefinition)

Example 5 with 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;
}
Also used : Schema(com.palantir.atlasdb.table.description.Schema) TableDefinition(com.palantir.atlasdb.table.description.TableDefinition)

Aggregations

Schema (com.palantir.atlasdb.table.description.Schema)11 AtlasSchema (com.palantir.atlasdb.schema.AtlasSchema)8 TableDefinition (com.palantir.atlasdb.table.description.TableDefinition)8 StreamStoreDefinitionBuilder (com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder)3 IndexDefinition (com.palantir.atlasdb.table.description.IndexDefinition)2 SweepConfig (com.palantir.atlasdb.config.SweepConfig)1 KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)1 ProfilingKeyValueService (com.palantir.atlasdb.keyvalue.impl.ProfilingKeyValueService)1 SweepStatsKeyValueService (com.palantir.atlasdb.keyvalue.impl.SweepStatsKeyValueService)1 TracingKeyValueService (com.palantir.atlasdb.keyvalue.impl.TracingKeyValueService)1 ValidatingQueryRewritingKeyValueService (com.palantir.atlasdb.keyvalue.impl.ValidatingQueryRewritingKeyValueService)1 JsonNodePersister (com.palantir.atlasdb.persister.JsonNodePersister)1 CompactSchema (com.palantir.atlasdb.schema.CompactSchema)1 SweepSchema (com.palantir.atlasdb.schema.SweepSchema)1 Idempotent (com.palantir.common.annotation.Idempotent)1 Provides (dagger.Provides)1 Named (javax.inject.Named)1 Singleton (javax.inject.Singleton)1