1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-08 05:47:07 +09:00
anytype-heart/pb/protos/changes.proto
2023-04-25 18:17:59 +02:00

155 lines
3.8 KiB
Protocol Buffer

syntax = "proto3";
package anytype;
option go_package = "pb";
import "pkg/lib/pb/model/protos/models.proto";
import "pb/protos/events.proto";
import "google/protobuf/struct.proto";
// the element of change tree used to store and internal apply smartBlock history
message Change {
// ids of previous changes
repeated string previous_ids = 1;
// id of the last snapshot
string last_snapshot_id = 2;
// ids of the last changes with details/relations content
repeated string previous_meta_ids = 5;
// set of actions to apply
repeated Content content = 3;
// snapshot - when not null, the Content will be ignored
Snapshot snapshot = 4;
// file keys related to changes content
repeated FileKeys fileKeys = 6;
// creation timestamp
int64 timestamp = 7;
// version of business logic
uint32 version = 8;
message Snapshot {
// logId -> lastChangeId
map<string, string> logHeads = 1;
// snapshot data
anytype.model.SmartBlockSnapshotBase data = 2;
// all file keys related to doc
repeated FileKeys fileKeys = 3;
}
message FileKeys {
string hash = 1;
map<string, string> keys = 2;
}
message Content {
oneof value {
BlockCreate blockCreate = 1;
BlockUpdate blockUpdate = 2;
BlockRemove blockRemove = 3;
BlockMove blockMove = 4;
BlockDuplicate blockDuplicate = 5;
RelationAdd relationAdd = 50;
RelationRemove relationRemove = 51;
DetailsSet detailsSet = 100;
DetailsUnset detailsUnset = 101;
// deprecated
_RelationAdd old_relationAdd = 102;
_RelationRemove old_relationRemove = 103;
_RelationUpdate old_relationUpdate = 104;
ObjectTypeAdd objectTypeAdd = 105;
ObjectTypeRemove objectTypeRemove = 106;
StoreKeySet storeKeySet = 107;
StoreKeyUnset storeKeyUnset = 108;
}
}
message BlockCreate {
string targetId = 1;
anytype.model.Block.Position position = 2;
repeated anytype.model.Block blocks = 3;
}
message BlockUpdate {
repeated Event.Message events = 2;
}
message BlockRemove {
repeated string ids = 1;
}
message BlockMove {
string targetId = 1;
anytype.model.Block.Position position = 2;
repeated string ids = 3;
}
message BlockDuplicate {
string targetId = 1;
anytype.model.Block.Position position = 2;
repeated string ids = 3;
}
message DetailsSet {
string key = 1;
google.protobuf.Value value = 2;
}
message DetailsUnset {
string key = 1;
}
message RelationAdd {
repeated anytype.model.RelationLink relationLinks = 1;
}
message RelationRemove {
repeated string relationKey = 1;
}
message _RelationAdd {
anytype.model.Relation relation = 2;
}
message _RelationUpdate {
message Dict {
repeated anytype.model.Relation.Option dict = 2;
}
message ObjectTypes {
repeated string objectTypes = 1;
}
string key = 1;
oneof value {
anytype.model.RelationFormat format = 2;
string name = 3;
google.protobuf.Value defaultValue = 4;
ObjectTypes objectTypes = 5;
bool multi = 6;
Dict selectDict = 7;
}
}
message _RelationRemove {
string key = 1;
}
message ObjectTypeAdd {
string url = 1;
}
message ObjectTypeRemove {
string url = 1;
}
message StoreKeySet {
repeated string path = 1;
google.protobuf.Value value = 2;
}
message StoreKeyUnset {
repeated string path = 1;
}
}