Documentation ¶
Index ¶
- Constants
- Variables
- type Action
- type Etcd
- func (e *Etcd) Broadcast(ctx context.Context, msg *Message) error
- func (e *Etcd) Client() *clientv3.Client
- func (e *Etcd) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)
- func (e *Etcd) Direct(ctx context.Context, node string, msg *Message) error
- func (e *Etcd) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
- func (e *Etcd) GrantLease(ctx context.Context, ttl int64) (*clientv3.LeaseGrantResponse, error)
- func (e *Etcd) PopulateCache() error
- func (e *Etcd) PublishConfigUpdate(ctx context.Context, msg *MessageUpdateConfig) error
- func (e *Etcd) PublishCreateComposite(ctx context.Context, comp *opts.Composite) error
- func (e *Etcd) PublishCreateConnection(ctx context.Context, conn *opts.ConnectionOptions) error
- func (e *Etcd) PublishCreateRead(ctx context.Context, read *opts.ReadOptions) error
- func (e *Etcd) PublishCreateRelay(ctx context.Context, relay *opts.RelayOptions) error
- func (e *Etcd) PublishCreateSchema(ctx context.Context, schema *protos.Schema) error
- func (e *Etcd) PublishCreateService(ctx context.Context, svc *protos.Service) error
- func (e *Etcd) PublishCreateValidation(ctx context.Context, validation *common.Validation) error
- func (e *Etcd) PublishDeleteComposite(ctx context.Context, comp *opts.Composite) error
- func (e *Etcd) PublishDeleteConnection(ctx context.Context, conn *opts.ConnectionOptions) error
- func (e *Etcd) PublishDeleteRead(ctx context.Context, read *opts.ReadOptions) error
- func (e *Etcd) PublishDeleteRelay(ctx context.Context, relay *opts.RelayOptions) error
- func (e *Etcd) PublishDeleteSchema(ctx context.Context, schema *protos.Schema) error
- func (e *Etcd) PublishDeleteService(ctx context.Context, svc *protos.Service) error
- func (e *Etcd) PublishDeleteValidation(ctx context.Context, validation *common.Validation) error
- func (e *Etcd) PublishUpdateComposite(ctx context.Context, comp *opts.Composite) error
- func (e *Etcd) PublishUpdateConnection(ctx context.Context, conn *opts.ConnectionOptions) error
- func (e *Etcd) PublishUpdateRelay(ctx context.Context, relay *opts.RelayOptions) error
- func (e *Etcd) PublishUpdateSchema(ctx context.Context, schema *protos.Schema) error
- func (e *Etcd) PublishUpdateService(ctx context.Context, svc *protos.Service) error
- func (e *Etcd) PublishUpdateValidation(ctx context.Context, validation *common.Validation) error
- func (e *Etcd) Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
- func (e *Etcd) PutWithTTL(ctx context.Context, key, val string, expires time.Duration) (*clientv3.PutResponse, error)
- func (e *Etcd) SaveConfig(ctx context.Context, cfg *config.Config) error
- func (e *Etcd) Shutdown(force bool) error
- func (e *Etcd) Start(serviceCtx context.Context) error
- type HandlerFunc
- type IEtcd
- type Message
- type MessageUpdateConfig
Constants ¶
const ( BroadcastPath = "/bus/broadcast" QueuePath = "/bus/queue" CacheErrorsPrefix = "/plumber-server/error-messages" CacheConnectionsPrefix = "/plumber-server/connections" CacheSchemasPrefix = "/plumber-server/schemas" CacheRelaysPrefix = "/plumber-server/relay" CacheServicesPrefix = "/plumber-server/services" CacheValidationsPrefix = "/plumber-server/validations" CacheServerConfigKey = "/plumber-server/server-config" CacheReadsPrefix = "/plumber-server/reads" CacheCompositesPrefix = "/plumber-server/composites" )
const ( CreateConnection = "CreateConnection" UpdateConnection = "UpdateConnection" DeleteConnection = "DeleteConnection" CreateService = "CreateService" UpdateService = "UpdateService" DeleteService = "DeleteService" CreateSchema = "CreateSchema" UpdateSchema = "UpdateSchema" DeleteSchema = "DeleteSchema" CreateRelay = "CreateRelay" UpdateRelay = "UpdateRelay" DeleteRelay = "DeleteRelay" CreateValidation = "CreateValidation" UpdateValidation = "UpdateValidation" DeleteValidation = "DeleteValidation" CreateRead = "CreateRead" DeleteRead = "DeleteRead" CreateComposite = "CreateComposite" UpdateComposite = "UpdateComposite" DeleteComposite = "DeleteComposite" UpdateConfig = "UpdateConfig" )
Variables ¶
var ( ServerNotStartedErr = errors.New("server not started") ServerAlreadyStartedErr = errors.New("server already started") )
var ( ErrMissingConfigMessage = errors.New("msg cannot be nil") ErrMissingGithubToken = errors.New("GithubToken cannot be empty") ErrMissingVCServiceToken = errors.New("VCServiceToken cannot be empty") )
var ( ValidActions = []Action{ CreateConnection, UpdateConnection, DeleteConnection, CreateService, UpdateService, DeleteService, CreateRelay, UpdateRelay, DeleteRelay, UpdateConfig, CreateRead, DeleteRead, CreateComposite, UpdateComposite, DeleteComposite, } )
Functions ¶
This section is empty.
Types ¶
type Etcd ¶
func (*Etcd) GrantLease ¶
func (*Etcd) PopulateCache ¶
PopulateCache loads config from etcd
func (*Etcd) PublishConfigUpdate ¶
func (e *Etcd) PublishConfigUpdate(ctx context.Context, msg *MessageUpdateConfig) error
PublishConfigUpdate publishes a MessageUpdateConfig message, which other plumber instances will receive and update their config with the new token
func (*Etcd) PublishCreateComposite ¶
PublishCreateComposite publishes a CreateComposite message, which other plumber instances will receive and add the service to their local in-memory maps
func (*Etcd) PublishCreateConnection ¶
PublishCreateConnection publishes a CreateConnection message, which other plumber instances will receive and add the connection to their local in-memory maps
func (*Etcd) PublishCreateRead ¶
PublishCreateRead publishes a CreateRead message, which other plumber instances will receive and add the service to their local in-memory maps
func (*Etcd) PublishCreateRelay ¶
PublishCreateRelay publishes a CreateRelay message, which other plumber instances will receive and add the service to their local in-memory maps
func (*Etcd) PublishCreateSchema ¶
PublishCreateSchema publishes a CreateSchema message, which other plumber instances will receive and add the service to their local in-memory maps
func (*Etcd) PublishCreateService ¶
PublishCreateService publishes a CreateService message, which other plumber instances will receive and add the service to their local in-memory maps
func (*Etcd) PublishCreateValidation ¶
PublishCreateValidation publishes a CreateValidation message, which other plumber instances will receive and add the service to their local in-memory maps
func (*Etcd) PublishDeleteComposite ¶
PublishDeleteComposite publishes a DeleteComposite message, which other plumber instances will receive and delete from their local in-memory maps
func (*Etcd) PublishDeleteConnection ¶
PublishDeleteConnection publishes a DeleteConnection message, which other plumber instances will receive and delete from their local in-memory maps
func (*Etcd) PublishDeleteRead ¶
PublishDeleteRead publishes a DeleteRead message, which other plumber instances will receive and delete from their local in-memory maps
func (*Etcd) PublishDeleteRelay ¶
PublishDeleteRelay publishes a DeleteRelay message, which other plumber instances will receive and delete from their local in-memory maps
func (*Etcd) PublishDeleteSchema ¶
PublishDeleteSchema publishes a DeleteSchema message, which other plumber instances will receive and delete from their local in-memory maps
func (*Etcd) PublishDeleteService ¶
PublishDeleteService publishes a DeleteService message, which other plumber instances will receive and delete from their local in-memory maps
func (*Etcd) PublishDeleteValidation ¶
PublishDeleteValidation publishes a DeleteValidation message, which other plumber instances will receive and delete from their local in-memory maps
func (*Etcd) PublishUpdateComposite ¶
PublishUpdateComposite publishes an UpdateComposite message, which other plumber instances will receive and update the connection in their local in-memory maps
func (*Etcd) PublishUpdateConnection ¶
PublishUpdateConnection publishes an UpdateConnection message, which other plumber instances will receive and update the connection in their local in-memory maps
func (*Etcd) PublishUpdateRelay ¶
PublishUpdateRelay publishes an UpdateRelay message, which other plumber instances will receive and update the connection in their local in-memory maps
func (*Etcd) PublishUpdateSchema ¶
PublishUpdateSchema publishes an UpdateSchema message, which other plumber instances will receive and update the connection in their local in-memory maps
func (*Etcd) PublishUpdateService ¶
PublishUpdateService publishes an UpdateService message, which other plumber instances will receive and update the connection in their local in-memory maps
func (*Etcd) PublishUpdateValidation ¶
PublishUpdateValidation publishes an UpdateValidation message, which other plumber instances will receive and update the connection in their local in-memory maps
func (*Etcd) PutWithTTL ¶
func (*Etcd) SaveConfig ¶
SaveConfig marshals a config.Config to JSON and saves it to etcd so that it can be retrieved on startup
type HandlerFunc ¶
type HandlerFunc func(context.Context, *clientv3.WatchResponse) error
type IEtcd ¶
type IEtcd interface { Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error) GrantLease(ctx context.Context, ttl int64) (*clientv3.LeaseGrantResponse, error) Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error) PutWithTTL(ctx context.Context, key, val string, expires time.Duration) (*clientv3.PutResponse, error) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error) Broadcast(ctx context.Context, msg *Message) error Direct(ctx context.Context, node string, msg *Message) error SaveConfig(ctx context.Context, cfg *config.Config) error Shutdown(force bool) error Start(serviceCtx context.Context) error PublishCreateService(ctx context.Context, svc *protos.Service) error PublishUpdateService(ctx context.Context, svc *protos.Service) error PublishDeleteService(ctx context.Context, svc *protos.Service) error PublishCreateConnection(ctx context.Context, conn *opts.ConnectionOptions) error PublishUpdateConnection(ctx context.Context, conn *opts.ConnectionOptions) error PublishDeleteConnection(ctx context.Context, conn *opts.ConnectionOptions) error PublishCreateSchema(ctx context.Context, schema *protos.Schema) error PublishUpdateSchema(ctx context.Context, schema *protos.Schema) error PublishDeleteSchema(ctx context.Context, schema *protos.Schema) error PublishCreateRelay(ctx context.Context, relay *opts.RelayOptions) error PublishUpdateRelay(ctx context.Context, relay *opts.RelayOptions) error PublishDeleteRelay(ctx context.Context, relay *opts.RelayOptions) error PublishConfigUpdate(ctx context.Context, msg *MessageUpdateConfig) error PublishCreateValidation(ctx context.Context, validation *common.Validation) error PublishUpdateValidation(ctx context.Context, validation *common.Validation) error PublishDeleteValidation(ctx context.Context, validation *common.Validation) error PublishCreateRead(ctx context.Context, svc *opts.ReadOptions) error PublishDeleteRead(ctx context.Context, svc *opts.ReadOptions) error PublishCreateComposite(ctx context.Context, validation *opts.Composite) error PublishUpdateComposite(ctx context.Context, validation *opts.Composite) error PublishDeleteComposite(ctx context.Context, validation *opts.Composite) error Client() *clientv3.Client }
type Message ¶
type MessageUpdateConfig ¶
type MessageUpdateConfig struct { VCServiceToken string `json:"vsservice_token"` GithubToken string `json:"oauth_token_github"` }
MessageUpdateConfig is emitted when a grpc.SetServerOptions() call is made