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: 10 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 (
	ErrInvalidLengthChat = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowChat   = fmt.Errorf("proto: integer overflow")
)

Functions

func RegisterChatServer

func RegisterChatServer(s *grpc.Server, srv ChatServer)

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 ChatClient

type ChatClient interface {
	// Sends a message to a peer.
	Message(ctx context.Context, in *ChatMessage, opts ...grpc.CallOption) (*Ack, error)
	// Gets the chat history with a peer.
	GetHistory(ctx context.Context, in *HistoryReq, opts ...grpc.CallOption) (Chat_GetHistoryClient, error)
}

func NewChatClient

func NewChatClient(cc *grpc.ClientConn) ChatClient

type ChatMessage

type ChatMessage struct {
	PeerId               []byte   `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	Message              string   `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

A chat message.

func (*ChatMessage) Descriptor

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

func (*ChatMessage) GetMessage

func (m *ChatMessage) GetMessage() string

func (*ChatMessage) GetPeerId

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

func (*ChatMessage) Marshal

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

func (*ChatMessage) MarshalTo

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

func (*ChatMessage) ProtoMessage

func (*ChatMessage) ProtoMessage()

func (*ChatMessage) Reset

func (m *ChatMessage) Reset()

func (*ChatMessage) Size

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

func (*ChatMessage) String

func (m *ChatMessage) String() string

func (*ChatMessage) Unmarshal

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

func (*ChatMessage) XXX_DiscardUnknown added in v0.2.0

func (m *ChatMessage) XXX_DiscardUnknown()

func (*ChatMessage) XXX_Marshal added in v0.2.0

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

func (*ChatMessage) XXX_Merge added in v0.2.0

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

func (*ChatMessage) XXX_Size added in v0.2.0

func (m *ChatMessage) XXX_Size() int

func (*ChatMessage) XXX_Unmarshal added in v0.2.0

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

type ChatServer

type ChatServer interface {
	// Sends a message to a peer.
	Message(context.Context, *ChatMessage) (*Ack, error)
	// Gets the chat history with a peer.
	GetHistory(*HistoryReq, Chat_GetHistoryServer) error
}

type Chat_GetHistoryClient

type Chat_GetHistoryClient interface {
	Recv() (*DatedMessage, error)
	grpc.ClientStream
}

type Chat_GetHistoryServer

type Chat_GetHistoryServer interface {
	Send(*DatedMessage) error
	grpc.ServerStream
}

type DatedMessage

type DatedMessage struct {
	From                 []byte           `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	To                   []byte           `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
	Content              string           `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
	Time                 *types.Timestamp `protobuf:"bytes,4,opt,name=time" json:"time,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func NewDatedMessageReceived

func NewDatedMessageReceived(from peer.ID, content string) *DatedMessage

NewDatedMessageReceived creates a new DatedMessage with a From field

func NewDatedMessageSent

func NewDatedMessageSent(to peer.ID, content string) *DatedMessage

NewDatedMessageSent creates a new DatedMessage with a to field

func (*DatedMessage) Descriptor

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

func (*DatedMessage) FromPeer

func (d *DatedMessage) FromPeer() (peer.ID, error)

FromPeer returns the sender peerID as go-libp2p-peer.ID

func (*DatedMessage) GetContent

func (m *DatedMessage) GetContent() string

func (*DatedMessage) GetFrom

func (m *DatedMessage) GetFrom() []byte

func (*DatedMessage) GetTime

func (m *DatedMessage) GetTime() *types.Timestamp

func (*DatedMessage) GetTo

func (m *DatedMessage) GetTo() []byte

func (*DatedMessage) Marshal

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

func (*DatedMessage) MarshalTo

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

func (*DatedMessage) ProtoMessage

func (*DatedMessage) ProtoMessage()

func (*DatedMessage) Reset

func (m *DatedMessage) Reset()

func (*DatedMessage) Size

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

func (*DatedMessage) String

func (m *DatedMessage) String() string

func (*DatedMessage) Unmarshal

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

func (*DatedMessage) XXX_DiscardUnknown added in v0.2.0

func (m *DatedMessage) XXX_DiscardUnknown()

func (*DatedMessage) XXX_Marshal added in v0.2.0

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

func (*DatedMessage) XXX_Merge added in v0.2.0

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

func (*DatedMessage) XXX_Size added in v0.2.0

func (m *DatedMessage) XXX_Size() int

func (*DatedMessage) XXX_Unmarshal added in v0.2.0

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

type HistoryReq

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

The request message to get the chat history with a peer.

func (*HistoryReq) Descriptor

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

func (*HistoryReq) GetPeerId

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

func (*HistoryReq) Marshal

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

func (*HistoryReq) MarshalTo

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

func (*HistoryReq) ProtoMessage

func (*HistoryReq) ProtoMessage()

func (*HistoryReq) Reset

func (m *HistoryReq) Reset()

func (*HistoryReq) Size

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

func (*HistoryReq) String

func (m *HistoryReq) String() string

func (*HistoryReq) Unmarshal

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

func (*HistoryReq) XXX_DiscardUnknown added in v0.2.0

func (m *HistoryReq) XXX_DiscardUnknown()

func (*HistoryReq) XXX_Marshal added in v0.2.0

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

func (*HistoryReq) XXX_Merge added in v0.2.0

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

func (*HistoryReq) XXX_Size added in v0.2.0

func (m *HistoryReq) XXX_Size() int

func (*HistoryReq) XXX_Unmarshal added in v0.2.0

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

Directories

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

Jump to

Keyboard shortcuts

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