rpc

package
v0.0.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetReply) Descriptor

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

func (*GetReply) GetIndex

func (m *GetReply) GetIndex() *Index

func (*GetReply) ProtoMessage

func (*GetReply) ProtoMessage()

func (*GetReply) Reset

func (m *GetReply) Reset()

func (*GetReply) String

func (m *GetReply) String() string

func (*GetReply) XXX_DiscardUnknown

func (m *GetReply) XXX_DiscardUnknown()

func (*GetReply) XXX_Marshal

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

func (*GetReply) XXX_Merge

func (m *GetReply) XXX_Merge(src proto.Message)

func (*GetReply) XXX_Size

func (m *GetReply) XXX_Size() int

func (*GetReply) XXX_Unmarshal

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

type GetRequest

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

func (*GetRequest) Descriptor

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

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) Reset

func (m *GetRequest) Reset()

func (*GetRequest) String

func (m *GetRequest) String() string

func (*GetRequest) XXX_DiscardUnknown

func (m *GetRequest) XXX_DiscardUnknown()

func (*GetRequest) XXX_Marshal

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

func (*GetRequest) XXX_Merge

func (m *GetRequest) XXX_Merge(src proto.Message)

func (*GetRequest) XXX_Size

func (m *GetRequest) XXX_Size() int

func (*GetRequest) XXX_Unmarshal

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

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 */
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func (*Index) Descriptor

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

func (*Index) GetLastUpdated

func (m *Index) GetLastUpdated() int64

func (*Index) GetStorage

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

func (*Index) GetStorageMedianPrice

func (m *Index) GetStorageMedianPrice() uint64

func (*Index) ProtoMessage

func (*Index) ProtoMessage()

func (*Index) Reset

func (m *Index) Reset()

func (*Index) String

func (m *Index) String() string

func (*Index) XXX_DiscardUnknown

func (m *Index) XXX_DiscardUnknown()

func (*Index) XXX_Marshal

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

func (*Index) XXX_Merge

func (m *Index) XXX_Merge(src proto.Message)

func (*Index) XXX_Size

func (m *Index) XXX_Size() int

func (*Index) XXX_Unmarshal

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

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Query) Descriptor

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

func (*Query) GetLimit

func (m *Query) GetLimit() int32

func (*Query) GetMaxPrice

func (m *Query) GetMaxPrice() uint64

func (*Query) GetOffset

func (m *Query) GetOffset() int32

func (*Query) GetPieceSize

func (m *Query) GetPieceSize() uint64

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) Reset

func (m *Query) Reset()

func (*Query) String

func (m *Query) String() string

func (*Query) XXX_DiscardUnknown

func (m *Query) XXX_DiscardUnknown()

func (*Query) XXX_Marshal

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

func (*Query) XXX_Merge

func (m *Query) XXX_Merge(src proto.Message)

func (*Query) XXX_Size

func (m *Query) XXX_Size() int

func (*Query) XXX_Unmarshal

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

type QueryReply

type QueryReply struct {
	Asks                 []*StorageAsk `protobuf:"bytes,1,rep,name=asks,proto3" json:"asks,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (*QueryReply) Descriptor

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

func (*QueryReply) GetAsks

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

func (*QueryReply) ProtoMessage

func (*QueryReply) ProtoMessage()

func (*QueryReply) Reset

func (m *QueryReply) Reset()

func (*QueryReply) String

func (m *QueryReply) String() string

func (*QueryReply) XXX_DiscardUnknown

func (m *QueryReply) XXX_DiscardUnknown()

func (*QueryReply) XXX_Marshal

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

func (*QueryReply) XXX_Merge

func (m *QueryReply) XXX_Merge(src proto.Message)

func (*QueryReply) XXX_Size

func (m *QueryReply) XXX_Size() int

func (*QueryReply) XXX_Unmarshal

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

type QueryRequest

type QueryRequest struct {
	Query                *Query   `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*QueryRequest) Descriptor

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

func (*QueryRequest) GetQuery

func (m *QueryRequest) GetQuery() *Query

func (*QueryRequest) ProtoMessage

func (*QueryRequest) ProtoMessage()

func (*QueryRequest) Reset

func (m *QueryRequest) Reset()

func (*QueryRequest) String

func (m *QueryRequest) String() string

func (*QueryRequest) XXX_DiscardUnknown

func (m *QueryRequest) XXX_DiscardUnknown()

func (*QueryRequest) XXX_Marshal

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

func (*QueryRequest) XXX_Merge

func (m *QueryRequest) XXX_Merge(src proto.Message)

func (*QueryRequest) XXX_Size

func (m *QueryRequest) XXX_Size() int

func (*QueryRequest) XXX_Unmarshal

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

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.ClientConn) 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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StorageAsk) Descriptor

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

func (*StorageAsk) GetExpiry

func (m *StorageAsk) GetExpiry() int64

func (*StorageAsk) GetMinPieceSize

func (m *StorageAsk) GetMinPieceSize() uint64

func (*StorageAsk) GetMiner

func (m *StorageAsk) GetMiner() string

func (*StorageAsk) GetPrice

func (m *StorageAsk) GetPrice() uint64

func (*StorageAsk) GetTimestamp

func (m *StorageAsk) GetTimestamp() int64

func (*StorageAsk) ProtoMessage

func (*StorageAsk) ProtoMessage()

func (*StorageAsk) Reset

func (m *StorageAsk) Reset()

func (*StorageAsk) String

func (m *StorageAsk) String() string

func (*StorageAsk) XXX_DiscardUnknown

func (m *StorageAsk) XXX_DiscardUnknown()

func (*StorageAsk) XXX_Marshal

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

func (*StorageAsk) XXX_Merge

func (m *StorageAsk) XXX_Merge(src proto.Message)

func (*StorageAsk) XXX_Size

func (m *StorageAsk) XXX_Size() int

func (*StorageAsk) XXX_Unmarshal

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

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