eventgate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package eventgate is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_schema_proto protoreflect.FileDescriptor

Functions

func RegisterEventGateServiceHandler added in v0.0.6

func RegisterEventGateServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterEventGateServiceHandler registers the http handlers for service EventGateService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterEventGateServiceHandlerClient added in v0.0.6

func RegisterEventGateServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EventGateServiceClient) error

RegisterEventGateServiceHandlerClient registers the http handlers for service EventGateService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EventGateServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EventGateServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "EventGateServiceClient" to call the correct interceptors.

func RegisterEventGateServiceHandlerFromEndpoint added in v0.0.6

func RegisterEventGateServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterEventGateServiceHandlerFromEndpoint is same as RegisterEventGateServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterEventGateServiceHandlerServer added in v0.0.6

func RegisterEventGateServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EventGateServiceServer) error

RegisterEventGateServiceHandlerServer registers the http handlers for service EventGateService to "mux". UnaryRPC :call EventGateServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterEventGateServiceHandlerFromEndpoint instead.

func RegisterEventGateServiceServer added in v0.0.6

func RegisterEventGateServiceServer(s *grpc.Server, srv EventGateServiceServer)

Types

type Event added in v0.0.10

type Event struct {

	// Identifies the event(uuid).
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// the unmodified
	Object *Object `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"`
	// The authentication claims of the event producer.
	Claims *_struct.Struct `protobuf:"bytes,3,opt,name=claims,proto3" json:"claims,omitempty"`
	// Timestamp(ns) of when the event was received.
	Time int64 `protobuf:"varint,4,opt,name=time,proto3" json:"time,omitempty"`
	// contains filtered or unexported fields
}

Event is primitive that represents a single state change to an object, who triggered it, and the time it occurred. Events are persisted to history & broadcasted to interested consumers(Stream) any time an object is created/modified

func (*Event) Descriptor deprecated added in v0.0.10

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

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetClaims added in v0.0.18

func (x *Event) GetClaims() *_struct.Struct

func (*Event) GetId added in v0.0.10

func (x *Event) GetId() string

func (*Event) GetObject added in v0.1.0

func (x *Event) GetObject() *Object

func (*Event) GetTime added in v0.0.10

func (x *Event) GetTime() int64

func (*Event) ProtoMessage added in v0.0.10

func (*Event) ProtoMessage()

func (*Event) ProtoReflect added in v0.0.10

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset added in v0.0.10

func (x *Event) Reset()

func (*Event) String added in v0.0.10

func (x *Event) String() string

func (*Event) Validate added in v0.0.10

func (this *Event) Validate() error

type EventGateServiceClient added in v0.0.6

type EventGateServiceClient interface {
	// SetObject sets the current state value of an object, adds it to the event log, then broadcast the event to all interested consumers
	SetObject(ctx context.Context, in *Object, opts ...grpc.CallOption) (*empty.Empty, error)
	// GetObject gets an object's current state values
	GetObject(ctx context.Context, in *ObjectRef, opts ...grpc.CallOption) (*Object, error)
	// StreamEvents creates an event stream/subscription to a given object type until fn returns false OR the context cancels.
	// Event Consumers invoke this method.
	StreamEvents(ctx context.Context, in *StreamOpts, opts ...grpc.CallOption) (EventGateService_StreamEventsClient, error)
	// SearchEvents returns an array of immutable historical events for a given object.
	SearchEvents(ctx context.Context, in *SearchOpts, opts ...grpc.CallOption) (*Events, error)
}

EventGateServiceClient is the client API for EventGateService service.

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

func NewEventGateServiceClient added in v0.0.6

func NewEventGateServiceClient(cc grpc.ClientConnInterface) EventGateServiceClient

type EventGateServiceServer added in v0.0.6

type EventGateServiceServer interface {
	// SetObject sets the current state value of an object, adds it to the event log, then broadcast the event to all interested consumers
	SetObject(context.Context, *Object) (*empty.Empty, error)
	// GetObject gets an object's current state values
	GetObject(context.Context, *ObjectRef) (*Object, error)
	// StreamEvents creates an event stream/subscription to a given object type until fn returns false OR the context cancels.
	// Event Consumers invoke this method.
	StreamEvents(*StreamOpts, EventGateService_StreamEventsServer) error
	// SearchEvents returns an array of immutable historical events for a given object.
	SearchEvents(context.Context, *SearchOpts) (*Events, error)
}

EventGateServiceServer is the server API for EventGateService service.

type EventGateService_StreamEventsClient added in v0.1.0

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

type EventGateService_StreamEventsServer added in v0.1.0

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

type Events added in v0.0.17

type Events struct {
	Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
	// contains filtered or unexported fields
}

Events is an array of events

func (*Events) Descriptor deprecated added in v0.0.17

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

Deprecated: Use Events.ProtoReflect.Descriptor instead.

func (*Events) GetEvents added in v0.0.17

func (x *Events) GetEvents() []*Event

func (*Events) ProtoMessage added in v0.0.17

func (*Events) ProtoMessage()

func (*Events) ProtoReflect added in v0.0.17

func (x *Events) ProtoReflect() protoreflect.Message

func (*Events) Reset added in v0.0.17

func (x *Events) Reset()

func (*Events) String added in v0.0.17

func (x *Events) String() string

func (*Events) Validate added in v0.0.17

func (this *Events) Validate() error

type Object added in v0.1.0

type Object struct {

	// Object type (ex: user)
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// Object key (unique within type)
	Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// Object values (structured k/v pairs)
	Values *_struct.Struct `protobuf:"bytes,3,opt,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

Object hold's the current state of an object

func (*Object) Descriptor deprecated added in v0.1.0

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

Deprecated: Use Object.ProtoReflect.Descriptor instead.

func (*Object) GetKey added in v0.1.0

func (x *Object) GetKey() string

func (*Object) GetType added in v0.1.0

func (x *Object) GetType() string

func (*Object) GetValues added in v0.1.0

func (x *Object) GetValues() *_struct.Struct

func (*Object) ProtoMessage added in v0.1.0

func (*Object) ProtoMessage()

func (*Object) ProtoReflect added in v0.1.0

func (x *Object) ProtoReflect() protoreflect.Message

func (*Object) Reset added in v0.1.0

func (x *Object) Reset()

func (*Object) String added in v0.1.0

func (x *Object) String() string

func (*Object) Validate added in v0.1.0

func (this *Object) Validate() error

type ObjectRef added in v0.1.0

type ObjectRef struct {

	// Object type (ex: user)
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// Object key (unique within type)
	Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

ObjectRef is a reference to an existing object

func (*ObjectRef) Descriptor deprecated added in v0.1.0

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

Deprecated: Use ObjectRef.ProtoReflect.Descriptor instead.

func (*ObjectRef) GetKey added in v0.1.0

func (x *ObjectRef) GetKey() string

func (*ObjectRef) GetType added in v0.1.0

func (x *ObjectRef) GetType() string

func (*ObjectRef) ProtoMessage added in v0.1.0

func (*ObjectRef) ProtoMessage()

func (*ObjectRef) ProtoReflect added in v0.1.0

func (x *ObjectRef) ProtoReflect() protoreflect.Message

func (*ObjectRef) Reset added in v0.1.0

func (x *ObjectRef) Reset()

func (*ObjectRef) String added in v0.1.0

func (x *ObjectRef) String() string

func (*ObjectRef) Validate added in v0.1.0

func (this *ObjectRef) Validate() error

type SearchOpts added in v0.1.0

type SearchOpts struct {

	// Object type (ex: user)
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// Object key (unique within type)
	Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// only return events that occurred after specified min timestamp
	Min int64 `protobuf:"varint,3,opt,name=min,proto3" json:"min,omitempty"`
	// only return events that occurred before specified max timestamp
	Max int64 `protobuf:"varint,4,opt,name=max,proto3" json:"max,omitempty"`
	// limit returned events
	Limit int64 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"`
	// offset returned events(pagination)
	Offset int64 `protobuf:"varint,6,opt,name=offset,proto3" json:"offset,omitempty"`
	// contains filtered or unexported fields
}

SearchOpts are options when querying historical events for a given object

func (*SearchOpts) Descriptor deprecated added in v0.1.0

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

Deprecated: Use SearchOpts.ProtoReflect.Descriptor instead.

func (*SearchOpts) GetKey added in v0.1.0

func (x *SearchOpts) GetKey() string

func (*SearchOpts) GetLimit added in v0.1.0

func (x *SearchOpts) GetLimit() int64

func (*SearchOpts) GetMax added in v0.1.0

func (x *SearchOpts) GetMax() int64

func (*SearchOpts) GetMin added in v0.1.0

func (x *SearchOpts) GetMin() int64

func (*SearchOpts) GetOffset added in v0.1.0

func (x *SearchOpts) GetOffset() int64

func (*SearchOpts) GetType added in v0.1.0

func (x *SearchOpts) GetType() string

func (*SearchOpts) ProtoMessage added in v0.1.0

func (*SearchOpts) ProtoMessage()

func (*SearchOpts) ProtoReflect added in v0.1.0

func (x *SearchOpts) ProtoReflect() protoreflect.Message

func (*SearchOpts) Reset added in v0.1.0

func (x *SearchOpts) Reset()

func (*SearchOpts) String added in v0.1.0

func (x *SearchOpts) String() string

func (*SearchOpts) Validate added in v0.1.0

func (this *SearchOpts) Validate() error

type StreamOpts added in v0.1.0

type StreamOpts struct {
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

StreamOpts are options for consumers looking to stream events

func (*StreamOpts) Descriptor deprecated added in v0.1.0

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

Deprecated: Use StreamOpts.ProtoReflect.Descriptor instead.

func (*StreamOpts) GetType added in v0.1.0

func (x *StreamOpts) GetType() string

func (*StreamOpts) ProtoMessage added in v0.1.0

func (*StreamOpts) ProtoMessage()

func (*StreamOpts) ProtoReflect added in v0.1.0

func (x *StreamOpts) ProtoReflect() protoreflect.Message

func (*StreamOpts) Reset added in v0.1.0

func (x *StreamOpts) Reset()

func (*StreamOpts) String added in v0.1.0

func (x *StreamOpts) String() string

func (*StreamOpts) Validate added in v0.1.0

func (this *StreamOpts) Validate() error

type UnimplementedEventGateServiceServer added in v0.0.6

type UnimplementedEventGateServiceServer struct {
}

UnimplementedEventGateServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedEventGateServiceServer) GetObject added in v0.1.0

func (*UnimplementedEventGateServiceServer) SearchEvents added in v0.1.0

func (*UnimplementedEventGateServiceServer) SetObject added in v0.1.0

func (*UnimplementedEventGateServiceServer) StreamEvents added in v0.1.0

Jump to

Keyboard shortcuts

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