services

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package services is a generated protocol buffer package.

It is generated from these files:

characterservice.proto

It has these top-level messages:

CommandMessage
EventMessage
SayCommand
CharacterDescription
RoomDescriptionEvent
CharacterWakesUpEvent
CharacterSleepsEvent
CharacterSpeaksEvent

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMalformedCharacterID means that the client connected with a malformed or missing
	// character ID in the metadata.
	ErrMalformedCharacterID = errors.New("character ID in metadata was missing or malformed")

	// ErrUnknownEventType is returned when an unknown type is dispatched to a characters event queue
	ErrUnknownEventType = errors.New("unknown event type")
)
View Source
var CommandType_name = map[int32]string{
	0: "CmdLook",
	1: "CmdSay",
}
View Source
var CommandType_value = map[string]int32{
	"CmdLook": 0,
	"CmdSay":  1,
}
View Source
var EventType_name = map[int32]string{
	0: "EvtRoomDescription",
	1: "EvtCharacterWakesUp",
	2: "EvtCharacterSleeps",
	3: "EvtCharacterSpeaks",
}
View Source
var EventType_value = map[string]int32{
	"EvtRoomDescription":  0,
	"EvtCharacterWakesUp": 1,
	"EvtCharacterSleeps":  2,
	"EvtCharacterSpeaks":  3,
}

Functions

func RegisterCharacterServer

func RegisterCharacterServer(s *grpc.Server, srv CharacterServer)

Types

type CharacterClient

type CharacterClient interface {
	Subscribe(ctx context.Context, opts ...grpc.CallOption) (Character_SubscribeClient, error)
}

func NewCharacterClient

func NewCharacterClient(cc *grpc.ClientConn) CharacterClient

type CharacterDescription

type CharacterDescription struct {
	Id    int64  `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	Name  string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
	Awake bool   `protobuf:"varint,3,opt,name=awake" json:"awake,omitempty"`
}

Events

func (*CharacterDescription) Descriptor

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

func (*CharacterDescription) GetAwake

func (m *CharacterDescription) GetAwake() bool

func (*CharacterDescription) GetId

func (m *CharacterDescription) GetId() int64

func (*CharacterDescription) GetName

func (m *CharacterDescription) GetName() string

func (*CharacterDescription) ProtoMessage

func (*CharacterDescription) ProtoMessage()

func (*CharacterDescription) Reset

func (m *CharacterDescription) Reset()

func (*CharacterDescription) String

func (m *CharacterDescription) String() string

type CharacterServer

type CharacterServer interface {
	Subscribe(Character_SubscribeServer) error
}

type CharacterService

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

CharacterService is a GRPC service for controlling characters.

func NewCharacterService

func NewCharacterService(controller simulation.CharacterController, logger *zap.Logger) *CharacterService

NewCharacterService returns a pointer to a character service and sets the character controller.

func (*CharacterService) Subscribe

func (s *CharacterService) Subscribe(stream Character_SubscribeServer) error

Subscribe is the handler for the bidrirectional GRPC stream of commands and events.

type CharacterSleepsEvent

type CharacterSleepsEvent struct {
	Character *CharacterDescription `protobuf:"bytes,1,opt,name=character" json:"character,omitempty"`
}

func (*CharacterSleepsEvent) Descriptor

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

func (*CharacterSleepsEvent) GetCharacter

func (m *CharacterSleepsEvent) GetCharacter() *CharacterDescription

func (*CharacterSleepsEvent) ProtoMessage

func (*CharacterSleepsEvent) ProtoMessage()

func (*CharacterSleepsEvent) Reset

func (m *CharacterSleepsEvent) Reset()

func (*CharacterSleepsEvent) String

func (m *CharacterSleepsEvent) String() string

type CharacterSpeaksEvent added in v0.0.2

type CharacterSpeaksEvent struct {
	Character *CharacterDescription `protobuf:"bytes,1,opt,name=character" json:"character,omitempty"`
	Content   string                `protobuf:"bytes,2,opt,name=content" json:"content,omitempty"`
}

func (*CharacterSpeaksEvent) Descriptor added in v0.0.2

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

func (*CharacterSpeaksEvent) GetCharacter added in v0.0.2

func (m *CharacterSpeaksEvent) GetCharacter() *CharacterDescription

func (*CharacterSpeaksEvent) GetContent added in v0.0.2

func (m *CharacterSpeaksEvent) GetContent() string

func (*CharacterSpeaksEvent) ProtoMessage added in v0.0.2

func (*CharacterSpeaksEvent) ProtoMessage()

func (*CharacterSpeaksEvent) Reset added in v0.0.2

func (m *CharacterSpeaksEvent) Reset()

func (*CharacterSpeaksEvent) String added in v0.0.2

func (m *CharacterSpeaksEvent) String() string

type CharacterWakesUpEvent

type CharacterWakesUpEvent struct {
	Character *CharacterDescription `protobuf:"bytes,1,opt,name=character" json:"character,omitempty"`
}

func (*CharacterWakesUpEvent) Descriptor

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

func (*CharacterWakesUpEvent) GetCharacter

func (m *CharacterWakesUpEvent) GetCharacter() *CharacterDescription

func (*CharacterWakesUpEvent) ProtoMessage

func (*CharacterWakesUpEvent) ProtoMessage()

func (*CharacterWakesUpEvent) Reset

func (m *CharacterWakesUpEvent) Reset()

func (*CharacterWakesUpEvent) String

func (m *CharacterWakesUpEvent) String() string

type Character_SubscribeClient

type Character_SubscribeClient interface {
	Send(*CommandMessage) error
	Recv() (*EventMessage, error)
	grpc.ClientStream
}

type Character_SubscribeServer

type Character_SubscribeServer interface {
	Send(*EventMessage) error
	Recv() (*CommandMessage, error)
	grpc.ServerStream
}

type CommandMessage

type CommandMessage struct {
	Type    CommandType `protobuf:"varint,1,opt,name=type,enum=services.CommandType" json:"type,omitempty"`
	Payload []byte      `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
}

func (*CommandMessage) Descriptor

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

func (*CommandMessage) GetPayload

func (m *CommandMessage) GetPayload() []byte

func (*CommandMessage) GetType

func (m *CommandMessage) GetType() CommandType

func (*CommandMessage) ProtoMessage

func (*CommandMessage) ProtoMessage()

func (*CommandMessage) Reset

func (m *CommandMessage) Reset()

func (*CommandMessage) String

func (m *CommandMessage) String() string

type CommandType

type CommandType int32
const (
	CommandType_CmdLook CommandType = 0
	CommandType_CmdSay  CommandType = 1
)

func (CommandType) EnumDescriptor

func (CommandType) EnumDescriptor() ([]byte, []int)

func (CommandType) String

func (x CommandType) String() string

type EventMessage

type EventMessage struct {
	Type    EventType `protobuf:"varint,1,opt,name=type,enum=services.EventType" json:"type,omitempty"`
	Payload []byte    `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
}

func (*EventMessage) Descriptor

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

func (*EventMessage) GetPayload

func (m *EventMessage) GetPayload() []byte

func (*EventMessage) GetType

func (m *EventMessage) GetType() EventType

func (*EventMessage) ProtoMessage

func (*EventMessage) ProtoMessage()

func (*EventMessage) Reset

func (m *EventMessage) Reset()

func (*EventMessage) String

func (m *EventMessage) String() string

type EventType

type EventType int32
const (
	EventType_EvtRoomDescription  EventType = 0
	EventType_EvtCharacterWakesUp EventType = 1
	EventType_EvtCharacterSleeps  EventType = 2
	EventType_EvtCharacterSpeaks  EventType = 3
)

func (EventType) EnumDescriptor

func (EventType) EnumDescriptor() ([]byte, []int)

func (EventType) String

func (x EventType) String() string

type RoomDescriptionEvent

type RoomDescriptionEvent struct {
	Name        string                  `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Description string                  `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"`
	Characters  []*CharacterDescription `protobuf:"bytes,3,rep,name=characters" json:"characters,omitempty"`
}

func (*RoomDescriptionEvent) Descriptor

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

func (*RoomDescriptionEvent) GetCharacters

func (m *RoomDescriptionEvent) GetCharacters() []*CharacterDescription

func (*RoomDescriptionEvent) GetDescription

func (m *RoomDescriptionEvent) GetDescription() string

func (*RoomDescriptionEvent) GetName

func (m *RoomDescriptionEvent) GetName() string

func (*RoomDescriptionEvent) ProtoMessage

func (*RoomDescriptionEvent) ProtoMessage()

func (*RoomDescriptionEvent) Reset

func (m *RoomDescriptionEvent) Reset()

func (*RoomDescriptionEvent) String

func (m *RoomDescriptionEvent) String() string

type SayCommand added in v0.0.2

type SayCommand struct {
	Content string `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"`
}

Commands

func (*SayCommand) Descriptor added in v0.0.2

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

func (*SayCommand) GetContent added in v0.0.2

func (m *SayCommand) GetContent() string

func (*SayCommand) ProtoMessage added in v0.0.2

func (*SayCommand) ProtoMessage()

func (*SayCommand) Reset added in v0.0.2

func (m *SayCommand) Reset()

func (*SayCommand) String added in v0.0.2

func (m *SayCommand) String() string

Jump to

Keyboard shortcuts

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