mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-10 18:10:54 +09:00
anyid proto
This commit is contained in:
parent
9b7d7e11a7
commit
9b481df4ce
4 changed files with 1659 additions and 0 deletions
2
Makefile
2
Makefile
|
@ -21,6 +21,8 @@ proto:
|
|||
protoc --gogofaster_out=:. net/secureservice/handshake/handshakeproto/protos/*.proto
|
||||
protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. coordinator/coordinatorproto/protos/*.proto
|
||||
protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. consensus/consensusproto/protos/*.proto
|
||||
protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. anyid/anyidproto/protos/*.proto
|
||||
|
||||
|
||||
deps:
|
||||
go mod download
|
||||
|
|
1416
anyid/anyidproto/anyid.pb.go
Normal file
1416
anyid/anyidproto/anyid.pb.go
Normal file
File diff suppressed because it is too large
Load diff
193
anyid/anyidproto/anyid_drpc.pb.go
Normal file
193
anyid/anyidproto/anyid_drpc.pb.go
Normal file
|
@ -0,0 +1,193 @@
|
|||
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
||||
// protoc-gen-go-drpc version: v0.0.33
|
||||
// source: anyid/anyidproto/protos/anyid.proto
|
||||
|
||||
package anyidproto
|
||||
|
||||
import (
|
||||
bytes "bytes"
|
||||
context "context"
|
||||
errors "errors"
|
||||
jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
drpc "storj.io/drpc"
|
||||
drpcerr "storj.io/drpc/drpcerr"
|
||||
)
|
||||
|
||||
type drpcEncoding_File_anyid_anyidproto_protos_anyid_proto struct{}
|
||||
|
||||
func (drpcEncoding_File_anyid_anyidproto_protos_anyid_proto) Marshal(msg drpc.Message) ([]byte, error) {
|
||||
return proto.Marshal(msg.(proto.Message))
|
||||
}
|
||||
|
||||
func (drpcEncoding_File_anyid_anyidproto_protos_anyid_proto) Unmarshal(buf []byte, msg drpc.Message) error {
|
||||
return proto.Unmarshal(buf, msg.(proto.Message))
|
||||
}
|
||||
|
||||
func (drpcEncoding_File_anyid_anyidproto_protos_anyid_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
err := new(jsonpb.Marshaler).Marshal(&buf, msg.(proto.Message))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func (drpcEncoding_File_anyid_anyidproto_protos_anyid_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
|
||||
return jsonpb.Unmarshal(bytes.NewReader(buf), msg.(proto.Message))
|
||||
}
|
||||
|
||||
type DRPCAnyIdClient interface {
|
||||
DRPCConn() drpc.Conn
|
||||
|
||||
DataPut(ctx context.Context, in *DataPutRequest) (*Ok, error)
|
||||
DataDelete(ctx context.Context, in *DataDeleteRequest) (*Ok, error)
|
||||
DataPull(ctx context.Context, in *DataPullRequest) (*DataPullResponse, error)
|
||||
}
|
||||
|
||||
type drpcAnyIdClient struct {
|
||||
cc drpc.Conn
|
||||
}
|
||||
|
||||
func NewDRPCAnyIdClient(cc drpc.Conn) DRPCAnyIdClient {
|
||||
return &drpcAnyIdClient{cc}
|
||||
}
|
||||
|
||||
func (c *drpcAnyIdClient) DRPCConn() drpc.Conn { return c.cc }
|
||||
|
||||
func (c *drpcAnyIdClient) DataPut(ctx context.Context, in *DataPutRequest) (*Ok, error) {
|
||||
out := new(Ok)
|
||||
err := c.cc.Invoke(ctx, "/anyid.AnyId/DataPut", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcAnyIdClient) DataDelete(ctx context.Context, in *DataDeleteRequest) (*Ok, error) {
|
||||
out := new(Ok)
|
||||
err := c.cc.Invoke(ctx, "/anyid.AnyId/DataDelete", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcAnyIdClient) DataPull(ctx context.Context, in *DataPullRequest) (*DataPullResponse, error) {
|
||||
out := new(DataPullResponse)
|
||||
err := c.cc.Invoke(ctx, "/anyid.AnyId/DataPull", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type DRPCAnyIdServer interface {
|
||||
DataPut(context.Context, *DataPutRequest) (*Ok, error)
|
||||
DataDelete(context.Context, *DataDeleteRequest) (*Ok, error)
|
||||
DataPull(context.Context, *DataPullRequest) (*DataPullResponse, error)
|
||||
}
|
||||
|
||||
type DRPCAnyIdUnimplementedServer struct{}
|
||||
|
||||
func (s *DRPCAnyIdUnimplementedServer) DataPut(context.Context, *DataPutRequest) (*Ok, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCAnyIdUnimplementedServer) DataDelete(context.Context, *DataDeleteRequest) (*Ok, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCAnyIdUnimplementedServer) DataPull(context.Context, *DataPullRequest) (*DataPullResponse, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
type DRPCAnyIdDescription struct{}
|
||||
|
||||
func (DRPCAnyIdDescription) NumMethods() int { return 3 }
|
||||
|
||||
func (DRPCAnyIdDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||
switch n {
|
||||
case 0:
|
||||
return "/anyid.AnyId/DataPut", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCAnyIdServer).
|
||||
DataPut(
|
||||
ctx,
|
||||
in1.(*DataPutRequest),
|
||||
)
|
||||
}, DRPCAnyIdServer.DataPut, true
|
||||
case 1:
|
||||
return "/anyid.AnyId/DataDelete", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCAnyIdServer).
|
||||
DataDelete(
|
||||
ctx,
|
||||
in1.(*DataDeleteRequest),
|
||||
)
|
||||
}, DRPCAnyIdServer.DataDelete, true
|
||||
case 2:
|
||||
return "/anyid.AnyId/DataPull", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCAnyIdServer).
|
||||
DataPull(
|
||||
ctx,
|
||||
in1.(*DataPullRequest),
|
||||
)
|
||||
}, DRPCAnyIdServer.DataPull, true
|
||||
default:
|
||||
return "", nil, nil, nil, false
|
||||
}
|
||||
}
|
||||
|
||||
func DRPCRegisterAnyId(mux drpc.Mux, impl DRPCAnyIdServer) error {
|
||||
return mux.Register(impl, DRPCAnyIdDescription{})
|
||||
}
|
||||
|
||||
type DRPCAnyId_DataPutStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*Ok) error
|
||||
}
|
||||
|
||||
type drpcAnyId_DataPutStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcAnyId_DataPutStream) SendAndClose(m *Ok) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCAnyId_DataDeleteStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*Ok) error
|
||||
}
|
||||
|
||||
type drpcAnyId_DataDeleteStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcAnyId_DataDeleteStream) SendAndClose(m *Ok) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCAnyId_DataPullStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*DataPullResponse) error
|
||||
}
|
||||
|
||||
type drpcAnyId_DataPullStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcAnyId_DataPullStream) SendAndClose(m *DataPullResponse) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
48
anyid/anyidproto/protos/anyid.proto
Normal file
48
anyid/anyidproto/protos/anyid.proto
Normal file
|
@ -0,0 +1,48 @@
|
|||
syntax = "proto3";
|
||||
package anyid;
|
||||
|
||||
option go_package = "anyid/anyidproto";
|
||||
|
||||
service AnyId {
|
||||
// DataPut puts client data to a repository
|
||||
rpc DataPut(DataPutRequest) returns (Ok);
|
||||
// DataDelete deletes client data from a repository
|
||||
rpc DataDelete(DataDeleteRequest) returns (Ok);
|
||||
// DataPull pulls client data from a repository
|
||||
rpc DataPull(DataPullRequest) returns (DataPullResponse);
|
||||
}
|
||||
|
||||
message Data {
|
||||
string king = 1;
|
||||
bytes data = 2;
|
||||
}
|
||||
|
||||
message DataPutRequest {
|
||||
// string representation of identity, must be equal handshake result
|
||||
string identity = 1;
|
||||
// data to save
|
||||
Data data = 2;
|
||||
}
|
||||
|
||||
message DataDeleteRequest {
|
||||
// string representation of identity, must be equal handshake result
|
||||
string identity = 1;
|
||||
// kinds of data to delete, if empty all kinds will be deleted
|
||||
repeated string kinds = 2;
|
||||
}
|
||||
|
||||
message DataPullRequest {
|
||||
// string representation of identity wanted to request
|
||||
string identity = 1;
|
||||
// kinds of data wanted to request
|
||||
repeated string kinds = 2;
|
||||
}
|
||||
|
||||
message DataPullResponse {
|
||||
string identity = 1;
|
||||
// a list of data with requested kinds
|
||||
repeated Data data = 2;
|
||||
}
|
||||
|
||||
|
||||
message Ok {}
|
Loading…
Add table
Add a link
Reference in a new issue