// Copyright 2022 ReductStore
// Licensed under the Business Source License 1.1
syntax = "proto3";
import "google/protobuf/timestamp.proto";
package reduct.proto.storage;
// Settings of bucket
message BucketSettings {
enum QuotaType {
NONE = 0; // No quota
FIFO = 1; // Remove oldest block in the bucket if we reach quota
HARD = 2; // Reject new records if we reach quota
}
optional uint64 max_block_size = 1; // max size of block in bytes
optional QuotaType quota_type = 2;
optional uint64 quota_size = 3; // size of quota in bytes
optional uint64 max_block_records = 4; // max number of records in a block
}
// Represents a stored blob in a block
message Record {
enum State {
STARTED = 0; // has at least one chunk written
FINISHED = 1; // finished without errors
ERRORED = 2; // finished with error
INVALID = 3; // something wierd happened
}
message Label {
string name = 1;
string value = 2;
}
google.protobuf.Timestamp timestamp = 1; // timestamp (works as ID)
uint64 begin = 2; // begin position of a blob in a block
uint64 end = 3; // end position of a blob in a block
State state = 4; // state of record
repeated Label labels = 5; // labels
string content_type = 6; // Content type of the record
}
// Represents a block of records.
// The storage engine create a new block if the current one bigger than EntrySettings::max_block_size
message Block {
message KeyValueMap {
uint64 key = 1;
string value = 2;
}
google.protobuf.Timestamp begin_time = 1; // when the block started being recorded
google.protobuf.Timestamp latest_record_time = 2; // the timestamp of the latest record
uint64 size = 3; // size of block in bytes (with protobuf overhead)
repeated Record records = 4; // stored records
// bool invalid = 5; // DEPRECATED: mark block as invalid if some IO happened
uint64 record_count = 6; // number of records in the block
uint64 metadata_size = 7; // size of metadata in bytes
}
// Represents a minimal block of records with no records
// to speed up the listing of blocks
message MinimalBlock {
google.protobuf.Timestamp begin_time = 1; // when the block started being recorded
google.protobuf.Timestamp latest_record_time = 2; // the timestamp of the latest record
uint64 size = 3; // size of block in bytes (with protobuf overhead)
// bool invalid = 5; // DEPRECATED: mark block as invalid if some IO happened
uint64 record_count = 6; // number of records in the block
uint64 metadata_size = 7; // size of metadata in bytes
}
// Represents a block index for an entry
message BlockIndex {
message Block {
uint64 block_id = 1; // block id
uint64 size = 2; // size of block in bytes
uint64 record_count = 3; // number of records in the block
uint64 metadata_size = 4; // size of metadata in bytes
google.protobuf.Timestamp latest_record_time = 5; // the timestamp of the latest record
optional uint64 crc64 = 6; // integrity check for a block
}
repeated Block blocks = 1;
uint64 crc64 = 2; // integrity check
}
// List of folders in the bucket or entry
message FolderMap {
message Item {
string name = 1;
string folder_name = 2;
}
repeated Item items = 1;
}