Documentation ¶
Index ¶
- Constants
- type Application
- type EtcdFakeKV
- func (c *EtcdFakeKV) Compact(ctx context.Context, rev int64, opts ...clientv3.CompactOption) (*clientv3.CompactResponse, error)
- func (c *EtcdFakeKV) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)
- func (c *EtcdFakeKV) Do(ctx context.Context, op clientv3.Op) (clientv3.OpResponse, error)
- func (c *EtcdFakeKV) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
- func (c *EtcdFakeKV) Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
- func (c *EtcdFakeKV) Txn(ctx context.Context) clientv3.Txn
Constants ¶
const ( // ReadyServerPort is the port number for the server that serves the readiness probe ReadyServerPort = int64(9095) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { // Config is the application config Config types.Config // contains filtered or unexported fields }
Application is a top level struct which serves as an entry point for this application.
func NewApplication ¶
func NewApplication(ctx context.Context, cancelFn context.CancelFunc, config types.Config, waitReadyTimeout time.Duration, logger *zap.Logger) (*Application, error)
NewApplication initializes and returns an application struct
func (*Application) Close ¶
func (a *Application) Close()
Close closes resources(e.g. etcd client) and cancels the context if not already done so.
func (*Application) Setup ¶
func (a *Application) Setup() error
Setup sets up etcd by triggering initialization of the etcd DB.
func (*Application) SetupReadinessProbe ¶
func (a *Application) SetupReadinessProbe()
SetupReadinessProbe sets up the readiness probe for this application. It is a blocking function and therefore the consumer should always call this within a go-routine unless the caller itself wants to block on this which is unlikely.
func (*Application) Start ¶
func (a *Application) Start() error
Start sets up readiness probe and starts an embedded etcd.
type EtcdFakeKV ¶
type EtcdFakeKV struct{}
EtcdFakeKV mocks the KV interface of etcd required to mock etcd get calls
func (*EtcdFakeKV) Compact ¶
func (c *EtcdFakeKV) Compact(ctx context.Context, rev int64, opts ...clientv3.CompactOption) (*clientv3.CompactResponse, error)
Compact compacts etcd KV history before the given rev.
func (*EtcdFakeKV) Delete ¶
func (c *EtcdFakeKV) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)
Delete deletes an entry with a given key.
func (*EtcdFakeKV) Do ¶
func (c *EtcdFakeKV) Do(ctx context.Context, op clientv3.Op) (clientv3.OpResponse, error)
Do applies a single Op on KV without a transaction.
func (*EtcdFakeKV) Get ¶
func (c *EtcdFakeKV) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
Get gets a value for a given key.