rpc

package
v0.0.1-beta.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_index_ask_rpc_rpc_proto protoreflect.FileDescriptor

Functions

func RegisterRPCServer

func RegisterRPCServer(s *grpc.Server, srv RPCServer)

Types

type GetReply

type GetReply struct {
	Index *Index `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
	// contains filtered or unexported fields
}

func (*GetReply) Descriptor deprecated

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

Deprecated: Use GetReply.ProtoReflect.Descriptor instead.

func (*GetReply) GetIndex

func (x *GetReply) GetIndex() *Index

func (*GetReply) ProtoMessage

func (*GetReply) ProtoMessage()

func (*GetReply) ProtoReflect

func (x *GetReply) ProtoReflect() protoreflect.Message

func (*GetReply) Reset

func (x *GetReply) Reset()

func (*GetReply) String

func (x *GetReply) String() string

type GetRequest

type GetRequest struct {
	// contains filtered or unexported fields
}

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

func (x *GetRequest) ProtoReflect() protoreflect.Message

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type Index

type Index struct {
	LastUpdated        int64                  `protobuf:"varint,1,opt,name=lastUpdated,proto3" json:"lastUpdated,omitempty"`
	StorageMedianPrice uint64                 `protobuf:"varint,2,opt,name=storageMedianPrice,proto3" json:"storageMedianPrice,omitempty"`
	Storage            map[string]*StorageAsk `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Index) Descriptor deprecated

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

Deprecated: Use Index.ProtoReflect.Descriptor instead.

func (*Index) GetLastUpdated

func (x *Index) GetLastUpdated() int64

func (*Index) GetStorage

func (x *Index) GetStorage() map[string]*StorageAsk

func (*Index) GetStorageMedianPrice

func (x *Index) GetStorageMedianPrice() uint64

func (*Index) ProtoMessage

func (*Index) ProtoMessage()

func (*Index) ProtoReflect

func (x *Index) ProtoReflect() protoreflect.Message

func (*Index) Reset

func (x *Index) Reset()

func (*Index) String

func (x *Index) String() string

type Query

type Query struct {
	MaxPrice  uint64 `protobuf:"varint,1,opt,name=maxPrice,proto3" json:"maxPrice,omitempty"`
	PieceSize uint64 `protobuf:"varint,2,opt,name=pieceSize,proto3" json:"pieceSize,omitempty"`
	Limit     int32  `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
	Offset    int32  `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"`
	// contains filtered or unexported fields
}

func (*Query) Descriptor deprecated

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

Deprecated: Use Query.ProtoReflect.Descriptor instead.

func (*Query) GetLimit

func (x *Query) GetLimit() int32

func (*Query) GetMaxPrice

func (x *Query) GetMaxPrice() uint64

func (*Query) GetOffset

func (x *Query) GetOffset() int32

func (*Query) GetPieceSize

func (x *Query) GetPieceSize() uint64

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) ProtoReflect

func (x *Query) ProtoReflect() protoreflect.Message

func (*Query) Reset

func (x *Query) Reset()

func (*Query) String

func (x *Query) String() string

type QueryReply

type QueryReply struct {
	Asks []*StorageAsk `protobuf:"bytes,1,rep,name=asks,proto3" json:"asks,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryReply) Descriptor deprecated

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

Deprecated: Use QueryReply.ProtoReflect.Descriptor instead.

func (*QueryReply) GetAsks

func (x *QueryReply) GetAsks() []*StorageAsk

func (*QueryReply) ProtoMessage

func (*QueryReply) ProtoMessage()

func (*QueryReply) ProtoReflect

func (x *QueryReply) ProtoReflect() protoreflect.Message

func (*QueryReply) Reset

func (x *QueryReply) Reset()

func (*QueryReply) String

func (x *QueryReply) String() string

type QueryRequest

type QueryRequest struct {
	Query *Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryRequest) Descriptor deprecated

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

Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.

func (*QueryRequest) GetQuery

func (x *QueryRequest) GetQuery() *Query

func (*QueryRequest) ProtoMessage

func (*QueryRequest) ProtoMessage()

func (*QueryRequest) ProtoReflect

func (x *QueryRequest) ProtoReflect() protoreflect.Message

func (*QueryRequest) Reset

func (x *QueryRequest) Reset()

func (*QueryRequest) String

func (x *QueryRequest) String() string

type RPC

type RPC struct {
	UnimplementedRPCServer
	// contains filtered or unexported fields
}

RPC implements the gprc service

func New

func New(ai *runner.Runner) *RPC

New creates a new rpc service

func (*RPC) Get

func (s *RPC) Get(ctx context.Context, req *GetRequest) (*GetReply, error)

Get returns the current Ask Storage index.

func (*RPC) Query

func (s *RPC) Query(ctx context.Context, req *QueryRequest) (*QueryReply, error)

Query executes a query on the current Ask Storage index.

type RPCClient

type RPCClient interface {
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetReply, error)
	Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryReply, error)
}

RPCClient is the client API for RPC service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewRPCClient

func NewRPCClient(cc grpc.ClientConnInterface) RPCClient

type RPCServer

type RPCServer interface {
	Get(context.Context, *GetRequest) (*GetReply, error)
	Query(context.Context, *QueryRequest) (*QueryReply, error)
}

RPCServer is the server API for RPC service.

type StorageAsk

type StorageAsk struct {
	Price        uint64 `protobuf:"varint,1,opt,name=price,proto3" json:"price,omitempty"`
	MinPieceSize uint64 `protobuf:"varint,2,opt,name=minPieceSize,proto3" json:"minPieceSize,omitempty"`
	Miner        string `protobuf:"bytes,3,opt,name=miner,proto3" json:"miner,omitempty"`
	Timestamp    int64  `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Expiry       int64  `protobuf:"varint,5,opt,name=expiry,proto3" json:"expiry,omitempty"`
	// contains filtered or unexported fields
}

func (*StorageAsk) Descriptor deprecated

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

Deprecated: Use StorageAsk.ProtoReflect.Descriptor instead.

func (*StorageAsk) GetExpiry

func (x *StorageAsk) GetExpiry() int64

func (*StorageAsk) GetMinPieceSize

func (x *StorageAsk) GetMinPieceSize() uint64

func (*StorageAsk) GetMiner

func (x *StorageAsk) GetMiner() string

func (*StorageAsk) GetPrice

func (x *StorageAsk) GetPrice() uint64

func (*StorageAsk) GetTimestamp

func (x *StorageAsk) GetTimestamp() int64

func (*StorageAsk) ProtoMessage

func (*StorageAsk) ProtoMessage()

func (*StorageAsk) ProtoReflect

func (x *StorageAsk) ProtoReflect() protoreflect.Message

func (*StorageAsk) Reset

func (x *StorageAsk) Reset()

func (*StorageAsk) String

func (x *StorageAsk) String() string

type UnimplementedRPCServer

type UnimplementedRPCServer struct {
}

UnimplementedRPCServer can be embedded to have forward compatible implementations.

func (*UnimplementedRPCServer) Get

func (*UnimplementedRPCServer) Query

Jump to

Keyboard shortcuts

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