Search in sources :

Example 6 with StreamStoreDefinitionBuilder

use of com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder in project atlasdb by palantir.

the class Benchmarks method createStreamingTable.

private static void createStreamingTable(KeyValueService kvs, TableReference parentTable, String columnName) {
    StreamStoreDefinition ssd = new StreamStoreDefinitionBuilder(columnName, "Value", ValueType.VAR_LONG).inMemoryThreshold(1024 * 1024).build();
    ssd.getTables().forEach((tableName, tableDefinition) -> {
        TableReference streamingTable = TableReference.create(parentTable.getNamespace(), tableName);
        kvs.createTable(streamingTable, tableDefinition.toTableMetadata().persistToBytes());
    });
}
Also used : StreamStoreDefinition(com.palantir.atlasdb.schema.stream.StreamStoreDefinition) TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) StreamStoreDefinitionBuilder(com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder)

Example 7 with StreamStoreDefinitionBuilder

use of com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder in project atlasdb by palantir.

the class StreamTestSchema method generateSchema.

private static Schema generateSchema() {
    Schema schema = new Schema("StreamTest", StreamTestSchema.class.getPackage().getName() + ".generated", Namespace.DEFAULT_NAMESPACE, OptionalType.JAVA8);
    schema.addTableDefinition("blobs", new TableDefinition() {

        {
            javaTableName("KeyValue");
            rangeScanAllowed();
            rowName();
            rowComponent("key", ValueType.STRING);
            columns();
            column("streamId", "s", ValueType.VAR_LONG);
        }
    });
    schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder("blob", "Value", ValueType.VAR_LONG).inMemoryThreshold(1024 * 1024).tableNameLogSafety(TableMetadataPersistence.LogSafety.SAFE).build());
    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 8 with StreamStoreDefinitionBuilder

use of com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder in project atlasdb by palantir.

the class ProfileSchema method generateSchema.

private static Schema generateSchema() {
    Schema schema = new Schema("Profile", ProfileSchema.class.getPackage().getName() + ".generated", Namespace.DEFAULT_NAMESPACE, OptionalType.JAVA8);
    schema.addTableDefinition("user_profile", new TableDefinition() {

        {
            allSafeForLoggingByDefault();
            rowName();
            rowComponent("id", ValueType.UUID);
            columns();
            column("metadata", "m", ProfilePersistence.UserProfile.class);
            column("create", "c", CreationData.Persister.class);
            column("json", "j", JsonNodePersister.class);
            column("photo_stream_id", "p", ValueType.FIXED_LONG);
        }
    });
    schema.addIndexDefinition("user_birthdays", new IndexDefinition(IndexType.CELL_REFERENCING) {

        {
            onTable("user_profile");
            allSafeForLoggingByDefault();
            rowName();
            componentFromColumn("birthday", ValueType.VAR_SIGNED_LONG, "metadata", "_value.getBirthEpochDay()");
            dynamicColumns();
            componentFromRow("id", ValueType.UUID);
            rangeScanAllowed();
            ignoreHotspottingChecks();
        }
    });
    schema.addIndexDefinition("created", new IndexDefinition(IndexType.CELL_REFERENCING) {

        {
            onTable("user_profile");
            allSafeForLoggingByDefault();
            rowName();
            componentFromColumn("time", ValueType.VAR_LONG, "create", "_value.getTimeCreated()");
            dynamicColumns();
            componentFromRow("id", ValueType.UUID);
            rangeScanAllowed();
            ignoreHotspottingChecks();
        }
    });
    schema.addIndexDefinition("cookies", new IndexDefinition(IndexType.CELL_REFERENCING) {

        {
            onTable("user_profile");
            allSafeForLoggingByDefault();
            rowName();
            componentFromIterableColumn("cookie", ValueType.STRING, ValueByteOrder.ASCENDING, "json", "com.palantir.example.profile.schema.ProfileSchema.getCookies(_value)");
            dynamicColumns();
            componentFromRow("id", ValueType.UUID);
            rangeScanAllowed();
        }
    });
    schema.addStreamStoreDefinition(new StreamStoreDefinitionBuilder("user_photos", "user_photos", ValueType.VAR_LONG).tableNameLogSafety(TableMetadataPersistence.LogSafety.SAFE).build());
    return schema;
}
Also used : IndexDefinition(com.palantir.atlasdb.table.description.IndexDefinition) 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) JsonNodePersister(com.palantir.atlasdb.persister.JsonNodePersister) JsonNodePersister(com.palantir.atlasdb.persister.JsonNodePersister)

Aggregations

StreamStoreDefinitionBuilder (com.palantir.atlasdb.schema.stream.StreamStoreDefinitionBuilder)8 Matchers.containsString (org.hamcrest.Matchers.containsString)4 Test (org.junit.Test)4 AtlasSchema (com.palantir.atlasdb.schema.AtlasSchema)3 Schema (com.palantir.atlasdb.table.description.Schema)3 TableDefinition (com.palantir.atlasdb.table.description.TableDefinition)3 TableReference (com.palantir.atlasdb.keyvalue.api.TableReference)1 JsonNodePersister (com.palantir.atlasdb.persister.JsonNodePersister)1 StreamStoreDefinition (com.palantir.atlasdb.schema.stream.StreamStoreDefinition)1 IndexDefinition (com.palantir.atlasdb.table.description.IndexDefinition)1