app

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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

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

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.

func (*EtcdFakeKV) Put

func (c *EtcdFakeKV) Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)

Put puts a value for a given key.

func (*EtcdFakeKV) Txn

func (c *EtcdFakeKV) Txn(ctx context.Context) clientv3.Txn

Txn creates a transaction.

Jump to

Keyboard shortcuts

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