81 lines
1.8 KiB
Protocol Buffer
81 lines
1.8 KiB
Protocol Buffer
|
syntax = "proto3";
|
||
|
package flsproto;
|
||
|
option go_package = "pkg/proto";
|
||
|
|
||
|
service StoreServer {
|
||
|
rpc ListFiles (Empty) returns (stream FileIdentifier);
|
||
|
rpc ReadFile (FileIdentifier) returns (StoreFileMeta);
|
||
|
// Should error if file already exists and is different
|
||
|
rpc WriteFile (StoreFileMeta) returns (Empty);
|
||
|
// Should only delete when there are no chunks, error otherwise
|
||
|
rpc DeleteFile (FileIdentifier) returns (Empty);
|
||
|
|
||
|
rpc ListChunks (Empty) returns (stream StoreChunkMeta);
|
||
|
rpc DescribeChunk (ChunkIdentifier) returns (StoreChunkMeta);
|
||
|
rpc ReadChunk (ChunkDataIdentifier) returns (ChunkData);
|
||
|
// Should error if chunk already exists
|
||
|
rpc WriteChunk (stream StoreChunkData) returns (StoreChunkMeta);
|
||
|
rpc DeleteChunk (ChunkIdentifier) returns (Empty);
|
||
|
}
|
||
|
|
||
|
message Empty {}
|
||
|
|
||
|
message FileIdentifier {
|
||
|
string fileId = 1;
|
||
|
}
|
||
|
|
||
|
message ChunkIdentifier {
|
||
|
FileIdentifier fileIdentifier = 1;
|
||
|
uint32 chunkId = 2;
|
||
|
}
|
||
|
|
||
|
message ChunkDataIdentifier {
|
||
|
ChunkIdentifier chunk = 1;
|
||
|
int64 offset = 2;
|
||
|
int64 size = 3;
|
||
|
}
|
||
|
|
||
|
message StoreFileMeta {
|
||
|
FileIdentifier fileIdentifier = 1;
|
||
|
bytes metaJson = 2;
|
||
|
}
|
||
|
|
||
|
message StoreChunkMeta {
|
||
|
ChunkIdentifier chunk = 1;
|
||
|
int64 size = 2;
|
||
|
}
|
||
|
|
||
|
message ChunkData {
|
||
|
bytes data = 1;
|
||
|
}
|
||
|
|
||
|
message StoreChunkData {
|
||
|
ChunkDataIdentifier dataIdentifier = 1;
|
||
|
ChunkData data = 2;
|
||
|
}
|
||
|
|
||
|
// todo: fs stuff
|
||
|
// maybe it looks like this, maybe it is more primitive/imperative...
|
||
|
|
||
|
// service FileServer {
|
||
|
// rpc Open (stream FileOperationRequest) returns (stream FileOperationResponse);
|
||
|
// }
|
||
|
|
||
|
// message FileOperationRequest {
|
||
|
// oneof Request {
|
||
|
// FileOperationRequest_Open open = 1;
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// message FileOperationRequest_Open {
|
||
|
// string path = 1;
|
||
|
// repeated string mode = 2;
|
||
|
// }
|
||
|
|
||
|
|
||
|
// message FileOperationResponse {
|
||
|
// oneof Response {
|
||
|
|
||
|
// }
|
||
|
// }
|