api

package
v0.0.0-...-168a2c3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package api is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientAuth

func ClientAuth(key *common.PrivateKey, genesis hash.Hash) grpc.UnaryClientInterceptor

ClientAuth makes client-side interceptor for identification.

func GrpcPeerHost

func GrpcPeerHost(ctx context.Context) string

GrpcPeerHost extracts client's host from grpc context.

func GrpcPeerID

func GrpcPeerID(ctx context.Context) hash.Peer

GrpcPeerID extracts client's ID from grpc context.

func IsProtoEmpty

func IsProtoEmpty(m *proto.Message) bool

IsProtoEmpty return true if it is typed nil (by protobuf sources).

func RegisterNodeServer

func RegisterNodeServer(s *grpc.Server, srv NodeServer)

func ServerAuth

func ServerAuth(key *common.PrivateKey, genesis hash.Hash) grpc.UnaryServerInterceptor

ServerAuth makes server-side interceptor for identification.

func ServerPeerID

func ServerPeerID(parent context.Context) (id *hash.Peer, ctx context.Context)

ServerPeerID makes context for gRPC call to get server-peer id.

func StartService

func StartService(bind string, key *common.PrivateKey, genesis hash.Hash, svc NodeServer, log func(string, ...interface{}), listen network.ListenFunc) (
	*grpc.Server, string)

StartService starts and returns gRPC server.

Types

type EventRequest

type EventRequest struct {
	PeerID               string   `protobuf:"bytes,1,opt,name=PeerID,proto3" json:"PeerID,omitempty"`
	Index                uint64   `protobuf:"varint,2,opt,name=Index,proto3" json:"Index,omitempty"`
	Hash                 []byte   `protobuf:"bytes,3,opt,name=Hash,proto3" json:"Hash,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EventRequest) Descriptor

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

func (*EventRequest) GetHash

func (m *EventRequest) GetHash() []byte

func (*EventRequest) GetIndex

func (m *EventRequest) GetIndex() uint64

func (*EventRequest) GetPeerID

func (m *EventRequest) GetPeerID() string

func (*EventRequest) ProtoMessage

func (*EventRequest) ProtoMessage()

func (*EventRequest) Reset

func (m *EventRequest) Reset()

func (*EventRequest) String

func (m *EventRequest) String() string

func (*EventRequest) XXX_DiscardUnknown

func (m *EventRequest) XXX_DiscardUnknown()

func (*EventRequest) XXX_Marshal

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

func (*EventRequest) XXX_Merge

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

func (*EventRequest) XXX_Size

func (m *EventRequest) XXX_Size() int

func (*EventRequest) XXX_Unmarshal

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

type KnownEvents

type KnownEvents struct {
	Lasts                map[string]uint64 `` /* 152-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*KnownEvents) Descriptor

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

func (*KnownEvents) GetLasts

func (m *KnownEvents) GetLasts() map[string]uint64

func (*KnownEvents) ProtoMessage

func (*KnownEvents) ProtoMessage()

func (*KnownEvents) Reset

func (m *KnownEvents) Reset()

func (*KnownEvents) String

func (m *KnownEvents) String() string

func (*KnownEvents) XXX_DiscardUnknown

func (m *KnownEvents) XXX_DiscardUnknown()

func (*KnownEvents) XXX_Marshal

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

func (*KnownEvents) XXX_Merge

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

func (*KnownEvents) XXX_Size

func (m *KnownEvents) XXX_Size() int

func (*KnownEvents) XXX_Unmarshal

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

type MockNodeClient

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

MockNodeClient is a mock of NodeClient interface

func NewMockNodeClient

func NewMockNodeClient(ctrl *gomock.Controller) *MockNodeClient

NewMockNodeClient creates a new mock instance

func (*MockNodeClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockNodeClient) GetEvent

func (m *MockNodeClient) GetEvent(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (*wire.Event, error)

GetEvent mocks base method

func (*MockNodeClient) GetPeerInfo

func (m *MockNodeClient) GetPeerInfo(ctx context.Context, in *PeerRequest, opts ...grpc.CallOption) (*PeerInfo, error)

GetPeerInfo mocks base method

func (*MockNodeClient) SyncEvents

func (m *MockNodeClient) SyncEvents(ctx context.Context, in *KnownEvents, opts ...grpc.CallOption) (*KnownEvents, error)

SyncEvents mocks base method

type MockNodeClientMockRecorder

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

MockNodeClientMockRecorder is the mock recorder for MockNodeClient

func (*MockNodeClientMockRecorder) GetEvent

func (mr *MockNodeClientMockRecorder) GetEvent(ctx, in interface{}, opts ...interface{}) *gomock.Call

GetEvent indicates an expected call of GetEvent

func (*MockNodeClientMockRecorder) GetPeerInfo

func (mr *MockNodeClientMockRecorder) GetPeerInfo(ctx, in interface{}, opts ...interface{}) *gomock.Call

GetPeerInfo indicates an expected call of GetPeerInfo

func (*MockNodeClientMockRecorder) SyncEvents

func (mr *MockNodeClientMockRecorder) SyncEvents(ctx, in interface{}, opts ...interface{}) *gomock.Call

SyncEvents indicates an expected call of SyncEvents

type MockNodeServer

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

MockNodeServer is a mock of NodeServer interface

func NewMockNodeServer

func NewMockNodeServer(ctrl *gomock.Controller) *MockNodeServer

NewMockNodeServer creates a new mock instance

func (*MockNodeServer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockNodeServer) GetEvent

func (m *MockNodeServer) GetEvent(arg0 context.Context, arg1 *EventRequest) (*wire.Event, error)

GetEvent mocks base method

func (*MockNodeServer) GetPeerInfo

func (m *MockNodeServer) GetPeerInfo(arg0 context.Context, arg1 *PeerRequest) (*PeerInfo, error)

GetPeerInfo mocks base method

func (*MockNodeServer) SyncEvents

func (m *MockNodeServer) SyncEvents(arg0 context.Context, arg1 *KnownEvents) (*KnownEvents, error)

SyncEvents mocks base method

type MockNodeServerMockRecorder

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

MockNodeServerMockRecorder is the mock recorder for MockNodeServer

func (*MockNodeServerMockRecorder) GetEvent

func (mr *MockNodeServerMockRecorder) GetEvent(arg0, arg1 interface{}) *gomock.Call

GetEvent indicates an expected call of GetEvent

func (*MockNodeServerMockRecorder) GetPeerInfo

func (mr *MockNodeServerMockRecorder) GetPeerInfo(arg0, arg1 interface{}) *gomock.Call

GetPeerInfo indicates an expected call of GetPeerInfo

func (*MockNodeServerMockRecorder) SyncEvents

func (mr *MockNodeServerMockRecorder) SyncEvents(arg0, arg1 interface{}) *gomock.Call

SyncEvents indicates an expected call of SyncEvents

type NodeClient

type NodeClient interface {
	SyncEvents(ctx context.Context, in *KnownEvents, opts ...grpc.CallOption) (*KnownEvents, error)
	GetEvent(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (*wire.Event, error)
	GetPeerInfo(ctx context.Context, in *PeerRequest, opts ...grpc.CallOption) (*PeerInfo, error)
}

NodeClient is the client API for Node service.

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

func NewNodeClient

func NewNodeClient(cc *grpc.ClientConn) NodeClient

type NodeServer

type NodeServer interface {
	SyncEvents(context.Context, *KnownEvents) (*KnownEvents, error)
	GetEvent(context.Context, *EventRequest) (*wire.Event, error)
	GetPeerInfo(context.Context, *PeerRequest) (*PeerInfo, error)
}

NodeServer is the server API for Node service.

type PeerIDs

type PeerIDs struct {
	IDs                  []string `protobuf:"bytes,1,rep,name=IDs,proto3" json:"IDs,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PeerIDs) Descriptor

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

func (*PeerIDs) GetIDs

func (m *PeerIDs) GetIDs() []string

func (*PeerIDs) ProtoMessage

func (*PeerIDs) ProtoMessage()

func (*PeerIDs) Reset

func (m *PeerIDs) Reset()

func (*PeerIDs) String

func (m *PeerIDs) String() string

func (*PeerIDs) XXX_DiscardUnknown

func (m *PeerIDs) XXX_DiscardUnknown()

func (*PeerIDs) XXX_Marshal

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

func (*PeerIDs) XXX_Merge

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

func (*PeerIDs) XXX_Size

func (m *PeerIDs) XXX_Size() int

func (*PeerIDs) XXX_Unmarshal

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

type PeerInfo

type PeerInfo struct {
	ID                   string   `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	PubKey               []byte   `protobuf:"bytes,2,opt,name=PubKey,proto3" json:"PubKey,omitempty"`
	Host                 string   `protobuf:"bytes,3,opt,name=Host,proto3" json:"Host,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PeerInfo) Descriptor

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

func (*PeerInfo) GetHost

func (m *PeerInfo) GetHost() string

func (*PeerInfo) GetID

func (m *PeerInfo) GetID() string

func (*PeerInfo) GetPubKey

func (m *PeerInfo) GetPubKey() []byte

func (*PeerInfo) ProtoMessage

func (*PeerInfo) ProtoMessage()

func (*PeerInfo) Reset

func (m *PeerInfo) Reset()

func (*PeerInfo) String

func (m *PeerInfo) String() string

func (*PeerInfo) XXX_DiscardUnknown

func (m *PeerInfo) XXX_DiscardUnknown()

func (*PeerInfo) XXX_Marshal

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

func (*PeerInfo) XXX_Merge

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

func (*PeerInfo) XXX_Size

func (m *PeerInfo) XXX_Size() int

func (*PeerInfo) XXX_Unmarshal

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

type PeerRequest

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

func (*PeerRequest) Descriptor

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

func (*PeerRequest) GetPeerID

func (m *PeerRequest) GetPeerID() string

func (*PeerRequest) ProtoMessage

func (*PeerRequest) ProtoMessage()

func (*PeerRequest) Reset

func (m *PeerRequest) Reset()

func (*PeerRequest) String

func (m *PeerRequest) String() string

func (*PeerRequest) XXX_DiscardUnknown

func (m *PeerRequest) XXX_DiscardUnknown()

func (*PeerRequest) XXX_Marshal

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

func (*PeerRequest) XXX_Merge

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

func (*PeerRequest) XXX_Size

func (m *PeerRequest) XXX_Size() int

func (*PeerRequest) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

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