blob: 8f8c59bb1c4e93e1e70a55856a2743b69037eb4c [file] [log] [blame]
// Copyright 2016 The Upspin Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
syntax = "proto3";
package proto;
// See proto.go for a description of these protocol buffers.
// Endpoint mirrors upspin.Endpoint.
message Endpoint {
int32 transport = 1;
string net_addr = 2;
}
// Location mirrors upspin.Location.
message Location {
Endpoint endpoint = 1;
string reference = 2;
}
// Refdata mirrors upspin.Refdata.
message Refdata {
string reference = 1;
bool volatile = 2;
int64 duration = 3;
}
// The Service interface.
message EndpointRequest {
}
message EndpointResponse {
Endpoint endpoint = 1;
}
// The Store interface.
message StoreGetRequest {
string reference = 1;
}
message StoreGetResponse {
bytes data = 1;
Refdata refdata = 2;
repeated Location locations = 3;
bytes error = 4;
}
message StorePutRequest {
bytes data = 1;
}
message StorePutResponse {
Refdata refdata = 1;
bytes error = 2;
}
message StoreDeleteRequest {
string reference = 1;
}
message StoreDeleteResponse {
bytes error = 1;
}
service Store {
// Service methods:
rpc Endpoint (EndpointRequest) returns (EndpointResponse) {}
rpc Get (StoreGetRequest) returns (StoreGetResponse) {}
rpc Put (StorePutRequest) returns (StorePutResponse) {}
rpc Delete (StoreDeleteRequest) returns (StoreDeleteResponse) {}
}
// The Key interface.
message User {
string name = 1;
repeated Endpoint dirs = 2;
repeated Endpoint stores = 3;
string public_key = 4;
}
message KeyLookupRequest {
string user_name = 1;
}
message KeyLookupResponse {
User user = 1;
bytes error = 2;
}
message KeyPutRequest {
User user = 1;
}
message KeyPutResponse {
bytes error = 1;
}
service Key {
// Service methods:
rpc Endpoint (EndpointRequest) returns (EndpointResponse) {}
rpc Lookup (KeyLookupRequest) returns (KeyLookupResponse) {}
rpc Put(KeyPutRequest) returns (KeyPutResponse) {}
}
// The DirServer interface.
// DirEntry values are stored as bytes, for simple and fast marshaling.
// (The upspin.DirEntry type has a Marshal method that returns a []byte;
// the alternative is to create a DirEntry proto message and copy the fields
// from one struct to the other, which is needless busywork.)
message EntryError {
bytes entry = 1;
bytes error = 2;
}
message EntriesError {
repeated bytes entries = 1;
bytes error = 2;
}
message DirLookupRequest {
string name = 1;
}
message DirPutRequest {
bytes entry = 1;
}
message DirGlobRequest {
string pattern = 1;
}
message DirDeleteRequest {
string name = 1;
}
message DirWhichAccessRequest {
string name = 1;
}
message DirWatchRequest {
string name = 1;
int64 sequence = 2;
}
// The first response in the stream is whether dir.Watch succeeded. If it
// didn't, the error field contains the error and no streaming happens. If it
// did succeed the error is nil and subsequent streams are from the Events
// channel.
message Event {
bytes entry = 1;
int64 sequence = 2;
bool delete = 3;
bytes error = 4;
}
service Dir{
// Service methods:
rpc Endpoint (EndpointRequest) returns (EndpointResponse) {}
rpc Lookup (DirLookupRequest) returns (EntryError) {}
rpc Put (DirPutRequest) returns (EntryError) {}
rpc Glob (DirGlobRequest) returns (EntriesError) {}
rpc Delete (DirDeleteRequest) returns (EntryError) {}
rpc WhichAccess (DirWhichAccessRequest) returns (EntryError) {}
rpc Watch (DirWatchRequest) returns (stream Event) {}
}