Create server side
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
version: v2
|
||||
plugins:
|
||||
- remote: buf.build/community/neoeinstein-prost
|
||||
out: ../src/proto/generated
|
||||
- remote: buf.build/community/neoeinstein-tonic
|
||||
out: ../src/proto/generated
|
||||
@@ -0,0 +1,9 @@
|
||||
version: v2
|
||||
modules:
|
||||
- path: .
|
||||
lint:
|
||||
use:
|
||||
- STANDARD
|
||||
breaking:
|
||||
use:
|
||||
- FILE
|
||||
@@ -0,0 +1,75 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package musicfs;
|
||||
|
||||
// MusicFs service exposes a server-side music library to a remote musicfs
|
||||
// FUSE mount. Three RPCs, all server-streaming so the client can pull
|
||||
// incrementally and the server can keep large bodies off the heap.
|
||||
service MusicFs {
|
||||
// Stream every file entry in the library. The client diffs each entry's
|
||||
// hash against its DB to decide what changed.
|
||||
rpc GetManifest(GetManifestRequest) returns (stream ManifestEntry);
|
||||
|
||||
// Stream the bytes of one file. If `start` and `length` are both set on
|
||||
// the request, only that byte range is sent; otherwise the whole file.
|
||||
// The first chunk carries `total_size` and `offset`; subsequent chunks
|
||||
// continue from there.
|
||||
rpc GetFile(GetFileRequest) returns (stream FileChunk);
|
||||
|
||||
// Long-lived stream of filesystem change events. The client uses these as
|
||||
// wake-ups to refetch the manifest; correctness always rests on the hash
|
||||
// diff, never on the event payload.
|
||||
rpc SubscribeEvents(SubscribeEventsRequest) returns (stream ChangeEvent);
|
||||
}
|
||||
|
||||
message GetManifestRequest {}
|
||||
|
||||
message GetFileRequest {
|
||||
uint64 id = 1;
|
||||
// When both are zero the server streams the entire file.
|
||||
uint64 start = 2;
|
||||
uint64 length = 3;
|
||||
}
|
||||
|
||||
message SubscribeEventsRequest {}
|
||||
|
||||
message ManifestEntry {
|
||||
uint64 id = 1;
|
||||
string rel_path = 2;
|
||||
uint64 size = 3;
|
||||
uint64 mtime = 4;
|
||||
uint64 ctime = 5;
|
||||
uint64 crtime = 6;
|
||||
MusicMetadata music_metadata = 7;
|
||||
}
|
||||
|
||||
message MusicMetadata {
|
||||
repeated string artist = 1;
|
||||
optional string album_artist = 2;
|
||||
string album = 3;
|
||||
int32 track_number = 4;
|
||||
string track_title = 5;
|
||||
repeated string other_tags = 6;
|
||||
bytes header = 7;
|
||||
repeated bytes picture_block_headers = 8;
|
||||
repeated PictureDataRange picture_data_ranges = 9;
|
||||
uint64 real_audio_start = 10;
|
||||
uint64 vorbis_comment_offset = 11;
|
||||
uint64 vorbis_comment_length = 12;
|
||||
}
|
||||
|
||||
message PictureDataRange {
|
||||
uint64 offset = 1;
|
||||
uint64 length = 2;
|
||||
}
|
||||
|
||||
message FileChunk {
|
||||
bytes data = 1;
|
||||
uint64 offset = 2;
|
||||
uint64 total_size = 3;
|
||||
}
|
||||
|
||||
message ChangeEvent {
|
||||
// "create", "modify", or "remove".
|
||||
string kind = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user