service

package
v0.0.0-...-75a04d1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAggregate

func NewAggregate(ctx context.Context, resourceId string, userDeviceIds []string, SnapshotThreshold int, eventstore EventStore, retry cqrs.RetryFunc) (*aggregate, error)

NewAggregate creates new resource aggreate - it must be created for every run command.

Types

type ClientCertManager

type ClientCertManager = interface {
	GetClientTLSConfig() tls.Config
}

type Config

type Config struct {
	grpc.Config
	AuthServerAddr               string `envconfig:"AUTH_SERVER_ADDRESS" default:"127.0.0.1:9100"`
	SnapshotThreshold            int    `envconfig:"SNAPSHOT_THRESHOLD" default:"128"`
	ConcurrencyExceptionMaxRetry int    `envconfig:"OCC_MAX_RETRY" default:"8"`
}

Config represent application configuration

func (Config) String

func (c Config) String() string

String return string representation of Config

type EventStore

type EventStore interface {
	cqrsEventStore.EventStore
	cqrsMaintenance.EventStore
	GetInstanceId(ctx context.Context, resourceId string) (int64, error)
	RemoveInstanceId(ctx context.Context, instanceId int64) error
}

type LogPublishErrFunc

type LogPublishErrFunc func(err error)

type RequestHandler

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

RequestHandler for handling incoming request

func NewRequestHandler

func NewRequestHandler(config Config, eventstore EventStore, publisher cqrsEventBus.Publisher, authClient pbAS.AuthorizationServiceClient) *RequestHandler

NewRequestHandler factory for new RequestHandler

func (RequestHandler) ConfirmResourceRetrieve

func (RequestHandler) ConfirmResourceUpdate

func (RequestHandler) GetUsersDevices

func (r RequestHandler) GetUsersDevices(ctx context.Context, authCtx *pb.AuthorizationContext) ([]string, error)

func (RequestHandler) NotifyResourceChanged

func (RequestHandler) PublishResource

func (RequestHandler) RetrieveResource

func (RequestHandler) UnpublishResource

func (RequestHandler) UpdateResource

type Server

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

Server handle HTTP request

func New

func New(config Config, clientCertManager ClientCertManager, serverCertManager ServerCertManager, eventStore EventStore, publisher cqrsEventBus.Publisher) *Server

New creates new Server with provided store and publisher.

func (*Server) Serve

func (s *Server) Serve() error

Serve serve starts the service's HTTP server and blocks.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown ends serving

type ServerCertManager

type ServerCertManager = interface {
	GetServerTLSConfig() tls.Config
}

Jump to

Keyboard shortcuts

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