syntax = "proto2";

package alluxio.proto.journal;

import "grpc/table/table_master.proto";

// Journal entry messages for the table master

// next available id: 6
message AttachDbEntry {
    optional string udb_type = 1;
    optional string udb_connection_uri = 2;
    optional string udb_db_name = 3;
    optional string db_name = 4;
    map<string, string> config = 5;
}

// next available id: 2
message DetachDbEntry {
    optional string db_name = 1;
}

// next available id: 13
message AddTableEntry {
    optional string db_name = 1;
    optional string table_name = 2;
    optional string owner = 3;
    optional alluxio.grpc.table.Schema schema = 4;
    optional alluxio.grpc.table.Layout layout = 5;
    repeated alluxio.grpc.table.ColumnStatisticsInfo table_stats = 6;
    map<string, string> parameters = 7;

    // partitioning scheme
    repeated alluxio.grpc.table.FieldSchema partition_cols = 8;
    repeated alluxio.grpc.table.Partition partitions = 9;

    optional int64 previous_version = 10;
    optional int64 version = 11;
    optional int64 version_creation_time = 12;
}

// next available id: 5
message RemoveTableEntry {
    optional string db_name = 1;
    optional string table_name = 2;
    optional int64 version = 4;
}

// next available id: 5
message CompleteTransformTableEntry {
    optional string db_name = 1;
    optional string table_name = 2;
    optional string definition = 3;
    // Map from partition spec to transformed layout
    map<string, alluxio.grpc.table.Layout> transformed_layouts = 4;
}

// next available id: 6
message AddTransformJobInfoEntry {
    optional string db_name = 1;
    optional string table_name = 2;
    optional string definition = 3;
    optional int64 job_id = 4;
    map<string, alluxio.grpc.table.Layout> transformed_layouts = 5;
}

// next available id: 3
message RemoveTransformJobInfoEntry {
    optional string db_name = 1;
    optional string table_name = 2;
}

// next available id: 6
message UpdateDatabaseInfoEntry {
    optional string db_name = 1;
    optional string location = 2;
    map<string, string> parameter = 3;
    optional string owner_name = 4;
    optional alluxio.grpc.table.PrincipalType owner_type = 5;
    optional string comment = 6;
}
