Files
quixos-protocol/proto/camino/schema.proto
T
2026-07-14 22:36:14 -07:00

208 lines
3.8 KiB
Protocol Buffer

syntax = "proto3";
package camino;
import "quixos/refs.proto";
message SymbolRef {
string namespace = 1;
string name = 2;
string version = 3;
string hash = 4;
}
enum ConflictStrategy {
CONFLICT_STRATEGY_UNSPECIFIED = 0;
REPLACE = 1;
PRESERVE_CONFLICTS = 2;
CRDT = 3;
}
enum Cardinality {
CARDINALITY_UNSPECIFIED = 0;
OPTIONAL_ONE = 1;
EXACTLY_ONE = 2;
MANY = 3;
MANY_UNIQUE = 4;
MANY_ORDERED = 5;
MANY_UNIQUE_ORDERED = 6;
}
enum DocRefStrength {
DOC_REF_STRENGTH_UNSPECIFIED = 0;
SOFT_REF = 1;
PROJECTED_EDGE = 2;
}
enum FieldStorageKind {
FIELD_STORAGE_KIND_UNSPECIFIED = 0;
STORED = 1;
DERIVED = 2;
LAZY = 3;
EXTERNAL = 4;
STATIC_FINAL = 5;
}
message Ref {
string object_id = 1;
}
message CustomField {}
message WatchStartResult {
string watch_id = 1;
}
message WatchStopRequest {
string watch_id = 1;
}
message WatchStopResult {}
message CrdtText {
bytes payload = 1;
}
message CrdtRichText {
bytes payload = 1;
}
message CrdtJson {
bytes payload = 1;
}
message ClassSchema {
SymbolRef id = 1;
uint32 version = 2;
repeated FieldSchema fields = 3;
repeated EdgeSchema edges = 4;
repeated MethodSchema methods = 5;
repeated MigrationSpec migrations = 6;
string source_file = 7;
string proto_message = 8;
repeated OperationServiceSchema operation_services = 9;
repeated InterfaceImplementationSchema implements = 10;
ConstructorSpec constructor = 11;
}
message FieldSchema {
string name = 1;
uint32 tag = 2;
TypeRef type = 3;
ConflictStrategy conflict = 4;
bool repeated = 5;
bool optional = 6;
FieldStorage storage = 7;
FieldOps ops = 8;
InterfaceFieldContract interface_contract = 9;
bool is_display_label = 10;
}
message FieldStorage {
FieldStorageKind kind = 1;
quixos.FunctionRef resolver = 2;
bool cache = 3;
}
message TypeRef {
string proto_type = 1;
SymbolRef symbol = 2;
}
message TypeBinding {
string name = 1;
TypeRef type = 2;
}
message InterfaceFieldContract {
bool required = 1;
bool readable = 2;
bool writable = 3;
bool watchable = 4;
string type_param = 5;
TypeRef type = 6;
}
message InterfaceImplementationSchema {
SymbolRef interface = 1;
repeated TypeBinding type_bindings = 2;
}
message InterfaceSchema {
SymbolRef id = 1;
uint32 version = 2;
repeated FieldSchema fields = 3;
string source_file = 4;
string proto_message = 5;
}
enum FieldImplementation {
FIELD_IMPLEMENTATION_UNSPECIFIED = 0;
SERVICE = 1;
}
message FieldOps {
FieldImplementation implementation = 1;
string service = 2;
}
message EdgeSchema {
SymbolRef id = 1;
// Legacy/source-side projection fields. Prefer from_endpoint/to_endpoint.
string source_field = 2;
SymbolRef from_class = 3;
SymbolRef to_class = 4;
Cardinality cardinality = 5;
string inverse = 6;
repeated FieldSchema fields = 7;
EdgeEndpointSchema from_endpoint = 8;
EdgeEndpointSchema to_endpoint = 9;
SymbolRef declaring_class = 10;
repeated SymbolRef tags = 11;
repeated SymbolRef implements = 12;
bool undirected = 13;
}
message EdgeEndpointSchema {
SymbolRef class = 1;
SymbolRef interface = 2;
string projection = 3;
Cardinality cardinality = 4;
bool indexed = 5;
}
message MethodSchema {
string name = 1;
quixos.FunctionRef function = 2;
}
message MigrationSpec {
uint32 from_version = 1;
uint32 to_version = 2;
quixos.FunctionRef function = 3;
}
message ConstructorSpec {
quixos.FunctionRef function = 1;
}
message OperationSchema {
string name = 1;
TypeRef input_type = 2;
TypeRef output_type = 3;
quixos.FunctionRef function = 4;
}
message OperationServiceSchema {
string name = 1;
string full_name = 2;
repeated OperationSchema operations = 3;
}
message DocRefDeclaration {
string local_name = 1;
SymbolRef type = 2;
SymbolRef target_class = 3;
DocRefStrength strength = 4;
}