internal

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Format_name = map[int32]string{
	0: "PROTOBUF",
	1: "JSON",
	2: "STRING",
}
View Source
var Format_value = map[string]int32{
	"PROTOBUF": 0,
	"JSON":     1,
	"STRING":   2,
}

Functions

func MarshalEvent

func MarshalEvent(e *hippo.Event) ([]byte, error)

MarshalEvent encodes a event to binary format.

func MarshalEventText

func MarshalEventText(e *hippo.Event) (string, error)

MarshalEventText encodes a event to compact string format.

func RegisterCommandServer

func RegisterCommandServer(s *grpc.Server, srv CommandServer)

func RegisterQueryServer

func RegisterQueryServer(s *grpc.Server, srv QueryServer)

func UnmarshalEvent

func UnmarshalEvent(data []byte, e *hippo.Event) error

UnmarshalEvent decodes a event from a binary data.

func UnmarshalEventText

func UnmarshalEventText(s string, e *hippo.Event) error

UnmarshalEventText decodes a event from a string format.

Types

type CommandClient

type CommandClient interface {
	CreateEvent(ctx context.Context, in *CreateEventRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	SnapshotEvent(ctx context.Context, in *SnapshotEventRequest, opts ...grpc.CallOption) (*empty.Empty, error)
}

CommandClient is the client API for Command service.

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

func NewCommandClient

func NewCommandClient(cc *grpc.ClientConn) CommandClient

type CommandServer

type CommandServer interface {
	CreateEvent(context.Context, *CreateEventRequest) (*empty.Empty, error)
	SnapshotEvent(context.Context, *SnapshotEventRequest) (*empty.Empty, error)
}

CommandServer is the server API for Command service.

type CreateEventRequest

type CreateEventRequest struct {
	// The event resource to create.
	Event                *Event   `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Request message for CreateEvent method.

func (*CreateEventRequest) Descriptor

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

func (*CreateEventRequest) GetEvent

func (m *CreateEventRequest) GetEvent() *Event

func (*CreateEventRequest) ProtoMessage

func (*CreateEventRequest) ProtoMessage()

func (*CreateEventRequest) Reset

func (m *CreateEventRequest) Reset()

func (*CreateEventRequest) String

func (m *CreateEventRequest) String() string

func (*CreateEventRequest) XXX_DiscardUnknown

func (m *CreateEventRequest) XXX_DiscardUnknown()

func (*CreateEventRequest) XXX_Marshal

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

func (*CreateEventRequest) XXX_Merge

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

func (*CreateEventRequest) XXX_Size

func (m *CreateEventRequest) XXX_Size() int

func (*CreateEventRequest) XXX_Unmarshal

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

type Event

type Event struct {
	// Topic (name) of the event. These should be written in the past tense (event_created)
	Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	// Aggregate ID is the primary key of the aggregate to which the event refers to.
	AggregateId string `protobuf:"bytes,2,opt,name=aggregate_id,json=aggregateId,proto3" json:"aggregate_id,omitempty"`
	// Version of the aggregate, useful when using concurrency writes.
	Version int64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
	// Schema of the aggregate.
	Schema string `protobuf:"bytes,4,opt,name=schema,proto3" json:"schema,omitempty"`
	// Format of the encoded type of the aggregate data
	Format Format `protobuf:"varint,5,opt,name=format,proto3,enum=internal.Format" json:"format,omitempty"`
	// Data raw object data.
	Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
	// Priority of the event, where 0 is the highest priority.
	Priority int32 `protobuf:"varint,7,opt,name=priority,proto3" json:"priority,omitempty"`
	// Signature includes SHA1 signature computed against it's contents and signature of the previous event.
	Signature string `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"`
	// Origin of the event. e.g. service name.
	OriginName string `protobuf:"bytes,9,opt,name=origin_name,json=originName,proto3" json:"origin_name,omitempty"`
	// Origin of the event. e.g. service ip address / browser.
	OriginIp string `protobuf:"bytes,10,opt,name=origin_ip,json=originIp,proto3" json:"origin_ip,omitempty"`
	// Metadata
	Metadata map[string]string `` /* 158-byte string literal not displayed */
	// CreateTime timestamp when event ocurred, location should be set to UTC.
	CreateTime           *timestamp.Timestamp `protobuf:"bytes,12,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

Event resource.

func (*Event) Descriptor

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

func (*Event) GetAggregateId

func (m *Event) GetAggregateId() string

func (*Event) GetCreateTime

func (m *Event) GetCreateTime() *timestamp.Timestamp

func (*Event) GetData

func (m *Event) GetData() []byte

func (*Event) GetFormat

func (m *Event) GetFormat() Format

func (*Event) GetMetadata

func (m *Event) GetMetadata() map[string]string

func (*Event) GetOriginIp

func (m *Event) GetOriginIp() string

func (*Event) GetOriginName

func (m *Event) GetOriginName() string

func (*Event) GetPriority

func (m *Event) GetPriority() int32

func (*Event) GetSchema

func (m *Event) GetSchema() string

func (*Event) GetSignature

func (m *Event) GetSignature() string

func (*Event) GetTopic

func (m *Event) GetTopic() string

func (*Event) GetVersion

func (m *Event) GetVersion() int64

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) Reset

func (m *Event) Reset()

func (*Event) String

func (m *Event) String() string

func (*Event) XXX_DiscardUnknown

func (m *Event) XXX_DiscardUnknown()

func (*Event) XXX_Marshal

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

func (*Event) XXX_Merge

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

func (*Event) XXX_Size

func (m *Event) XXX_Size() int

func (*Event) XXX_Unmarshal

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

type Format

type Format int32

Format enumerator

const (
	Format_PROTOBUF Format = 0
	Format_JSON     Format = 1
	Format_STRING   Format = 2
)

func (Format) EnumDescriptor

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

func (Format) String

func (x Format) String() string

type GetEventRequest

type GetEventRequest struct {
	// The ID of the event is based on the aggregate_id and version
	AggregateId          string   `protobuf:"bytes,1,opt,name=aggregate_id,json=aggregateId,proto3" json:"aggregate_id,omitempty"`
	Version              int64    `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Request message for GetEvent method.

func (*GetEventRequest) Descriptor

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

func (*GetEventRequest) GetAggregateId

func (m *GetEventRequest) GetAggregateId() string

func (*GetEventRequest) GetVersion

func (m *GetEventRequest) GetVersion() int64

func (*GetEventRequest) ProtoMessage

func (*GetEventRequest) ProtoMessage()

func (*GetEventRequest) Reset

func (m *GetEventRequest) Reset()

func (*GetEventRequest) String

func (m *GetEventRequest) String() string

func (*GetEventRequest) XXX_DiscardUnknown

func (m *GetEventRequest) XXX_DiscardUnknown()

func (*GetEventRequest) XXX_Marshal

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

func (*GetEventRequest) XXX_Merge

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

func (*GetEventRequest) XXX_Size

func (m *GetEventRequest) XXX_Size() int

func (*GetEventRequest) XXX_Unmarshal

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

type ListEventsRequest

type ListEventsRequest struct {
	// The ID of the event is based on the aggregate_id and version
	AggregateId          string   `protobuf:"bytes,1,opt,name=aggregate_id,json=aggregateId,proto3" json:"aggregate_id,omitempty"`
	VersionMin           int64    `protobuf:"varint,2,opt,name=version_min,json=versionMin,proto3" json:"version_min,omitempty"`
	VersionMax           int64    `protobuf:"varint,3,opt,name=version_max,json=versionMax,proto3" json:"version_max,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Request message for ListEvents method.

func (*ListEventsRequest) Descriptor

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

func (*ListEventsRequest) GetAggregateId

func (m *ListEventsRequest) GetAggregateId() string

func (*ListEventsRequest) GetVersionMax

func (m *ListEventsRequest) GetVersionMax() int64

func (*ListEventsRequest) GetVersionMin

func (m *ListEventsRequest) GetVersionMin() int64

func (*ListEventsRequest) ProtoMessage

func (*ListEventsRequest) ProtoMessage()

func (*ListEventsRequest) Reset

func (m *ListEventsRequest) Reset()

func (*ListEventsRequest) String

func (m *ListEventsRequest) String() string

func (*ListEventsRequest) XXX_DiscardUnknown

func (m *ListEventsRequest) XXX_DiscardUnknown()

func (*ListEventsRequest) XXX_Marshal

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

func (*ListEventsRequest) XXX_Merge

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

func (*ListEventsRequest) XXX_Size

func (m *ListEventsRequest) XXX_Size() int

func (*ListEventsRequest) XXX_Unmarshal

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

type QueryClient

type QueryClient interface {
	GetEvent(ctx context.Context, in *GetEventRequest, opts ...grpc.CallOption) (*Event, error)
	ListEvents(ctx context.Context, in *ListEventsRequest, opts ...grpc.CallOption) (Query_ListEventsClient, error)
}

QueryClient is the client API for Query service.

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

func NewQueryClient

func NewQueryClient(cc *grpc.ClientConn) QueryClient

type QueryServer

type QueryServer interface {
	GetEvent(context.Context, *GetEventRequest) (*Event, error)
	ListEvents(*ListEventsRequest, Query_ListEventsServer) error
}

QueryServer is the server API for Query service.

type Query_ListEventsClient

type Query_ListEventsClient interface {
	Recv() (*Event, error)
	grpc.ClientStream
}

type Query_ListEventsServer

type Query_ListEventsServer interface {
	Send(*Event) error
	grpc.ServerStream
}

type SnapshotEventRequest

type SnapshotEventRequest struct {
	// The event resource to snapshot.
	Event                *Event   `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Request message for SnapshotEvent method.

func (*SnapshotEventRequest) Descriptor

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

func (*SnapshotEventRequest) GetEvent

func (m *SnapshotEventRequest) GetEvent() *Event

func (*SnapshotEventRequest) ProtoMessage

func (*SnapshotEventRequest) ProtoMessage()

func (*SnapshotEventRequest) Reset

func (m *SnapshotEventRequest) Reset()

func (*SnapshotEventRequest) String

func (m *SnapshotEventRequest) String() string

func (*SnapshotEventRequest) XXX_DiscardUnknown

func (m *SnapshotEventRequest) XXX_DiscardUnknown()

func (*SnapshotEventRequest) XXX_Marshal

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

func (*SnapshotEventRequest) XXX_Merge

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

func (*SnapshotEventRequest) XXX_Size

func (m *SnapshotEventRequest) XXX_Size() int

func (*SnapshotEventRequest) XXX_Unmarshal

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

type UnimplementedCommandServer

type UnimplementedCommandServer struct {
}

UnimplementedCommandServer can be embedded to have forward compatible implementations.

func (*UnimplementedCommandServer) CreateEvent

func (*UnimplementedCommandServer) SnapshotEvent

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) GetEvent

func (*UnimplementedQueryServer) ListEvents

Jump to

Keyboard shortcuts

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