grpc

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthStorage = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowStorage   = fmt.Errorf("proto: integer overflow")
)

Functions

func RegisterStorageServer

func RegisterStorageServer(s *grpc.Server, srv StorageServer)

Types

type Ack

type Ack struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

An empty ack.

func (*Ack) Descriptor

func (*Ack) Descriptor() ([]byte, []int)

func (*Ack) Marshal

func (m *Ack) Marshal() (dAtA []byte, err error)

func (*Ack) MarshalTo

func (m *Ack) MarshalTo(dAtA []byte) (int, error)

func (*Ack) ProtoMessage

func (*Ack) ProtoMessage()

func (*Ack) Reset

func (m *Ack) Reset()

func (*Ack) Size

func (m *Ack) Size() (n int)

func (*Ack) String

func (m *Ack) String() string

func (*Ack) Unmarshal

func (m *Ack) Unmarshal(dAtA []byte) error

func (*Ack) XXX_DiscardUnknown added in v0.2.0

func (m *Ack) XXX_DiscardUnknown()

func (*Ack) XXX_Marshal added in v0.2.0

func (m *Ack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Ack) XXX_Merge added in v0.2.0

func (dst *Ack) XXX_Merge(src proto.Message)

func (*Ack) XXX_Size added in v0.2.0

func (m *Ack) XXX_Size() int

func (*Ack) XXX_Unmarshal added in v0.2.0

func (m *Ack) XXX_Unmarshal(b []byte) error

type AuthRequest

type AuthRequest struct {
	PeerIds              [][]byte `protobuf:"bytes,1,rep,name=peer_ids,json=peerIds" json:"peer_ids,omitempty"`
	FileHash             []byte   `protobuf:"bytes,2,opt,name=file_hash,json=fileHash,proto3" json:"file_hash,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*AuthRequest) Descriptor

func (*AuthRequest) Descriptor() ([]byte, []int)

func (*AuthRequest) GetFileHash

func (m *AuthRequest) GetFileHash() []byte

func (*AuthRequest) GetPeerIds

func (m *AuthRequest) GetPeerIds() [][]byte

func (*AuthRequest) Marshal

func (m *AuthRequest) Marshal() (dAtA []byte, err error)

func (*AuthRequest) MarshalTo

func (m *AuthRequest) MarshalTo(dAtA []byte) (int, error)

func (*AuthRequest) ProtoMessage

func (*AuthRequest) ProtoMessage()

func (*AuthRequest) Reset

func (m *AuthRequest) Reset()

func (*AuthRequest) Size

func (m *AuthRequest) Size() (n int)

func (*AuthRequest) String

func (m *AuthRequest) String() string

func (*AuthRequest) Unmarshal

func (m *AuthRequest) Unmarshal(dAtA []byte) error

func (*AuthRequest) XXX_DiscardUnknown added in v0.2.0

func (m *AuthRequest) XXX_DiscardUnknown()

func (*AuthRequest) XXX_Marshal added in v0.2.0

func (m *AuthRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AuthRequest) XXX_Merge added in v0.2.0

func (dst *AuthRequest) XXX_Merge(src proto.Message)

func (*AuthRequest) XXX_Size added in v0.2.0

func (m *AuthRequest) XXX_Size() int

func (*AuthRequest) XXX_Unmarshal added in v0.2.0

func (m *AuthRequest) XXX_Unmarshal(b []byte) error

type DownloadRequest

type DownloadRequest struct {
	PeerId               []byte   `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	FileHash             []byte   `protobuf:"bytes,2,opt,name=file_hash,json=fileHash,proto3" json:"file_hash,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DownloadRequest) Descriptor

func (*DownloadRequest) Descriptor() ([]byte, []int)

func (*DownloadRequest) GetFileHash

func (m *DownloadRequest) GetFileHash() []byte

func (*DownloadRequest) GetPeerId

func (m *DownloadRequest) GetPeerId() []byte

func (*DownloadRequest) Marshal

func (m *DownloadRequest) Marshal() (dAtA []byte, err error)

func (*DownloadRequest) MarshalTo

func (m *DownloadRequest) MarshalTo(dAtA []byte) (int, error)

func (*DownloadRequest) ProtoMessage

func (*DownloadRequest) ProtoMessage()

func (*DownloadRequest) Reset

func (m *DownloadRequest) Reset()

func (*DownloadRequest) Size

func (m *DownloadRequest) Size() (n int)

func (*DownloadRequest) String

func (m *DownloadRequest) String() string

func (*DownloadRequest) Unmarshal

func (m *DownloadRequest) Unmarshal(dAtA []byte) error

func (*DownloadRequest) XXX_DiscardUnknown added in v0.2.0

func (m *DownloadRequest) XXX_DiscardUnknown()

func (*DownloadRequest) XXX_Marshal added in v0.2.0

func (m *DownloadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DownloadRequest) XXX_Merge added in v0.2.0

func (dst *DownloadRequest) XXX_Merge(src proto.Message)

func (*DownloadRequest) XXX_Size added in v0.2.0

func (m *DownloadRequest) XXX_Size() int

func (*DownloadRequest) XXX_Unmarshal added in v0.2.0

func (m *DownloadRequest) XXX_Unmarshal(b []byte) error

type SessionFileChunk

type SessionFileChunk struct {
	// file name is required only on first message.
	Id                   []byte   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Data                 []byte   `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SessionFileChunk) Descriptor

func (*SessionFileChunk) Descriptor() ([]byte, []int)

func (*SessionFileChunk) GetData

func (m *SessionFileChunk) GetData() []byte

func (*SessionFileChunk) GetId

func (m *SessionFileChunk) GetId() []byte

func (*SessionFileChunk) Marshal

func (m *SessionFileChunk) Marshal() (dAtA []byte, err error)

func (*SessionFileChunk) MarshalTo

func (m *SessionFileChunk) MarshalTo(dAtA []byte) (int, error)

func (*SessionFileChunk) ProtoMessage

func (*SessionFileChunk) ProtoMessage()

func (*SessionFileChunk) Reset

func (m *SessionFileChunk) Reset()

func (*SessionFileChunk) Size

func (m *SessionFileChunk) Size() (n int)

func (*SessionFileChunk) String

func (m *SessionFileChunk) String() string

func (*SessionFileChunk) Unmarshal

func (m *SessionFileChunk) Unmarshal(dAtA []byte) error

func (*SessionFileChunk) XXX_DiscardUnknown added in v0.2.0

func (m *SessionFileChunk) XXX_DiscardUnknown()

func (*SessionFileChunk) XXX_Marshal added in v0.2.0

func (m *SessionFileChunk) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SessionFileChunk) XXX_Merge added in v0.2.0

func (dst *SessionFileChunk) XXX_Merge(src proto.Message)

func (*SessionFileChunk) XXX_Size added in v0.2.0

func (m *SessionFileChunk) XXX_Size() int

func (*SessionFileChunk) XXX_Unmarshal added in v0.2.0

func (m *SessionFileChunk) XXX_Unmarshal(b []byte) error

type StorageClient

type StorageClient interface {
	// Upload a file to the Stratumn node.
	Upload(ctx context.Context, opts ...grpc.CallOption) (Storage_UploadClient, error)
	// Sends a request to the server to start a new upload.
	StartUpload(ctx context.Context, in *UploadReq, opts ...grpc.CallOption) (*UploadSession, error)
	// Upload a single chunk of a file to the server.
	UploadChunk(ctx context.Context, in *SessionFileChunk, opts ...grpc.CallOption) (*Ack, error)
	// Notifies the server that the session's file has been entirely sent.
	EndUpload(ctx context.Context, in *UploadSession, opts ...grpc.CallOption) (*UploadAck, error)
	// Give peers access to a file.
	AuthorizePeers(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*Ack, error)
	// Download downloads a file from a peer.
	Download(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (Storage_DownloadClient, error)
}

func NewStorageClient

func NewStorageClient(cc *grpc.ClientConn) StorageClient

type StorageServer

type StorageServer interface {
	// Upload a file to the Stratumn node.
	Upload(Storage_UploadServer) error
	// Sends a request to the server to start a new upload.
	StartUpload(context.Context, *UploadReq) (*UploadSession, error)
	// Upload a single chunk of a file to the server.
	UploadChunk(context.Context, *SessionFileChunk) (*Ack, error)
	// Notifies the server that the session's file has been entirely sent.
	EndUpload(context.Context, *UploadSession) (*UploadAck, error)
	// Give peers access to a file.
	AuthorizePeers(context.Context, *AuthRequest) (*Ack, error)
	// Download downloads a file from a peer.
	Download(*DownloadRequest, Storage_DownloadServer) error
}

type Storage_DownloadClient

type Storage_DownloadClient interface {
	Recv() (*pb.FileChunk, error)
	grpc.ClientStream
}

type Storage_DownloadServer

type Storage_DownloadServer interface {
	Send(*pb.FileChunk) error
	grpc.ServerStream
}

type Storage_UploadClient

type Storage_UploadClient interface {
	Send(*pb.FileChunk) error
	CloseAndRecv() (*UploadAck, error)
	grpc.ClientStream
}

type Storage_UploadServer

type Storage_UploadServer interface {
	SendAndClose(*UploadAck) error
	Recv() (*pb.FileChunk, error)
	grpc.ServerStream
}

type UploadAck

type UploadAck struct {
	FileHash             []byte   `protobuf:"bytes,1,opt,name=file_hash,json=fileHash,proto3" json:"file_hash,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UploadAck) Descriptor

func (*UploadAck) Descriptor() ([]byte, []int)

func (*UploadAck) GetFileHash

func (m *UploadAck) GetFileHash() []byte

func (*UploadAck) Marshal

func (m *UploadAck) Marshal() (dAtA []byte, err error)

func (*UploadAck) MarshalTo

func (m *UploadAck) MarshalTo(dAtA []byte) (int, error)

func (*UploadAck) ProtoMessage

func (*UploadAck) ProtoMessage()

func (*UploadAck) Reset

func (m *UploadAck) Reset()

func (*UploadAck) Size

func (m *UploadAck) Size() (n int)

func (*UploadAck) String

func (m *UploadAck) String() string

func (*UploadAck) Unmarshal

func (m *UploadAck) Unmarshal(dAtA []byte) error

func (*UploadAck) XXX_DiscardUnknown added in v0.2.0

func (m *UploadAck) XXX_DiscardUnknown()

func (*UploadAck) XXX_Marshal added in v0.2.0

func (m *UploadAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UploadAck) XXX_Merge added in v0.2.0

func (dst *UploadAck) XXX_Merge(src proto.Message)

func (*UploadAck) XXX_Size added in v0.2.0

func (m *UploadAck) XXX_Size() int

func (*UploadAck) XXX_Unmarshal added in v0.2.0

func (m *UploadAck) XXX_Unmarshal(b []byte) error

type UploadReq

type UploadReq struct {
	FileName             string   `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UploadReq) Descriptor

func (*UploadReq) Descriptor() ([]byte, []int)

func (*UploadReq) GetFileName

func (m *UploadReq) GetFileName() string

func (*UploadReq) Marshal

func (m *UploadReq) Marshal() (dAtA []byte, err error)

func (*UploadReq) MarshalTo

func (m *UploadReq) MarshalTo(dAtA []byte) (int, error)

func (*UploadReq) ProtoMessage

func (*UploadReq) ProtoMessage()

func (*UploadReq) Reset

func (m *UploadReq) Reset()

func (*UploadReq) Size

func (m *UploadReq) Size() (n int)

func (*UploadReq) String

func (m *UploadReq) String() string

func (*UploadReq) Unmarshal

func (m *UploadReq) Unmarshal(dAtA []byte) error

func (*UploadReq) XXX_DiscardUnknown added in v0.2.0

func (m *UploadReq) XXX_DiscardUnknown()

func (*UploadReq) XXX_Marshal added in v0.2.0

func (m *UploadReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UploadReq) XXX_Merge added in v0.2.0

func (dst *UploadReq) XXX_Merge(src proto.Message)

func (*UploadReq) XXX_Size added in v0.2.0

func (m *UploadReq) XXX_Size() int

func (*UploadReq) XXX_Unmarshal added in v0.2.0

func (m *UploadReq) XXX_Unmarshal(b []byte) error

type UploadSession

type UploadSession struct {
	Id                   []byte   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UploadSession) Descriptor

func (*UploadSession) Descriptor() ([]byte, []int)

func (*UploadSession) GetId

func (m *UploadSession) GetId() []byte

func (*UploadSession) Marshal

func (m *UploadSession) Marshal() (dAtA []byte, err error)

func (*UploadSession) MarshalTo

func (m *UploadSession) MarshalTo(dAtA []byte) (int, error)

func (*UploadSession) ProtoMessage

func (*UploadSession) ProtoMessage()

func (*UploadSession) Reset

func (m *UploadSession) Reset()

func (*UploadSession) Size

func (m *UploadSession) Size() (n int)

func (*UploadSession) String

func (m *UploadSession) String() string

func (*UploadSession) Unmarshal

func (m *UploadSession) Unmarshal(dAtA []byte) error

func (*UploadSession) XXX_DiscardUnknown added in v0.2.0

func (m *UploadSession) XXX_DiscardUnknown()

func (*UploadSession) XXX_Marshal added in v0.2.0

func (m *UploadSession) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UploadSession) XXX_Merge added in v0.2.0

func (dst *UploadSession) XXX_Merge(src proto.Message)

func (*UploadSession) XXX_Size added in v0.2.0

func (m *UploadSession) XXX_Size() int

func (*UploadSession) XXX_Unmarshal added in v0.2.0

func (m *UploadSession) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis
Package mockstorage is a generated GoMock package.
Package mockstorage is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL