gw

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidItemProof = errors.New("proof does not match the given item")
)

ErrInvalidItemProof ...

Functions

This section is empty.

Types

type HistoryHandler

type HistoryHandler interface {
	History(w http.ResponseWriter, req *http.Request, pathParams map[string]string)
}

HistoryHandler ...

func NewHistoryHandler

func NewHistoryHandler(mux *runtime.ServeMux, client client.ImmuClient, rt Runtime, json json.JSON) HistoryHandler

NewHistoryHandler ...

type ImmuGw added in v0.7.0

type ImmuGw interface {
	Start() error
	Stop() error
	WithClient(schema.ImmuServiceClient) ImmuGw
	WithLogger(logger.Logger) ImmuGw
	WithOptions(Options) ImmuGw
	WithCliOptions(client.Options) ImmuGw
}

ImmuGw ...

type ImmuGwServer

type ImmuGwServer struct {
	Options    Options
	CliOptions client.Options

	Logger       logger.Logger
	Pid          server.PIDFile
	Client       schema.ImmuServiceClient
	MetricServer *metricServer
	// contains filtered or unexported fields
}

ImmuGwServer ...

func DefaultServer

func DefaultServer() *ImmuGwServer

DefaultServer returns a default immudb gateway server

func (*ImmuGwServer) Start

func (s *ImmuGwServer) Start() error

Start starts the immudb gateway server

func (*ImmuGwServer) Stop

func (s *ImmuGwServer) Stop() error

Stop stops the immudb gateway server

func (*ImmuGwServer) WithCliOptions added in v0.7.0

func (c *ImmuGwServer) WithCliOptions(cliOptions client.Options) ImmuGw

WithCliOptions ...

func (*ImmuGwServer) WithClient

func (c *ImmuGwServer) WithClient(client schema.ImmuServiceClient) ImmuGw

WithClient ...

func (*ImmuGwServer) WithLogger

func (c *ImmuGwServer) WithLogger(logger logger.Logger) ImmuGw

WithLogger ...

func (*ImmuGwServer) WithOptions

func (c *ImmuGwServer) WithOptions(options Options) ImmuGw

WithOptions ...

type ImmuGwServerMock added in v0.7.0

type ImmuGwServerMock struct {
	StartF          func() error
	StopF           func() error
	WithClientF     func(schema.ImmuServiceClient) ImmuGw
	WithLoggerF     func(logger.Logger) ImmuGw
	WithOptionsF    func(Options) ImmuGw
	WithCliOptionsF func(client.Options) ImmuGw
}

ImmuGwServerMock ...

func (*ImmuGwServerMock) Start added in v0.7.0

func (igm *ImmuGwServerMock) Start() error

Start ...

func (*ImmuGwServerMock) Stop added in v0.7.0

func (igm *ImmuGwServerMock) Stop() error

Stop ...

func (*ImmuGwServerMock) WithCliOptions added in v0.7.0

func (igm *ImmuGwServerMock) WithCliOptions(options client.Options) ImmuGw

WithCliOptions ...

func (*ImmuGwServerMock) WithClient added in v0.7.0

func (igm *ImmuGwServerMock) WithClient(client schema.ImmuServiceClient) ImmuGw

WithClient ...

func (*ImmuGwServerMock) WithLogger added in v0.7.0

func (igm *ImmuGwServerMock) WithLogger(logger logger.Logger) ImmuGw

WithLogger ...

func (*ImmuGwServerMock) WithOptions added in v0.7.0

func (igm *ImmuGwServerMock) WithOptions(options Options) ImmuGw

WithOptions ...

type LastAuditResult

type LastAuditResult struct {
	ServerID               string
	ServerAddress          string
	HasRunConsistencyCheck bool
	HasError               bool
	ConsistencyCheckResult bool
	PreviousRootIndex      float64
	PreviousRoot           string
	CurrentRootIndex       float64
	CurrentRoot            string
	RunAt                  time.Time
	sync.RWMutex
}

LastAuditResult ...

type MetricsCollection

type MetricsCollection struct {
	AuditResultPerServer   *prometheus.GaugeVec
	AuditPrevRootPerServer *prometheus.GaugeVec
	AuditCurrRootPerServer *prometheus.GaugeVec
	AuditRunAtPerServer    *prometheus.GaugeVec

	UptimeCounter prometheus.CounterFunc
	// contains filtered or unexported fields
}

MetricsCollection the gateway metrics collection

func (MetricsCollection) UpdateAuditResult

func (mc MetricsCollection) UpdateAuditResult(
	serverID string,
	serverAddress string,
	checked bool,
	withError bool,
	result bool,
	prevRoot *schema.Root,
	currRoot *schema.Root,
)

UpdateAuditResult updates the metrics related to audit result

func (MetricsCollection) WithUptimeCounter

func (mc MetricsCollection) WithUptimeCounter(reg *prometheus.Registry, f func() float64)

WithUptimeCounter ...

type Options

type Options struct {
	Dir           string
	Address       string
	Port          int
	MetricsPort   int
	ImmudbAddress string
	ImmudbPort    int
	Audit         bool
	AuditInterval time.Duration
	AuditUsername string
	AuditPassword string `json:"-"`
	Detached      bool
	MTLs          bool
	MTLsOptions   client.MTLsOptions
	Config        string
	Pidfile       string
	Logfile       string
}

Options immudb gateway server options

func DefaultOptions

func DefaultOptions() Options

DefaultOptions ...

func (Options) Bind

func (o Options) Bind() string

Bind concatenates address and port

func (Options) MetricsBind

func (o Options) MetricsBind() string

MetricsBind return metrics bind address

func (Options) String

func (o Options) String() string

func (Options) WithAddress

func (o Options) WithAddress(address string) Options

WithAddress sets address

func (Options) WithAudit

func (o Options) WithAudit(audit bool) Options

WithAudit sets Audit

func (Options) WithAuditInterval

func (o Options) WithAuditInterval(auditInterval time.Duration) Options

WithAuditInterval sets AuditInterval

func (Options) WithAuditPassword

func (o Options) WithAuditPassword(auditPassword string) Options

WithAuditPassword sets AuditPasswordauditUsername

func (Options) WithAuditUsername

func (o Options) WithAuditUsername(auditUsername string) Options

WithAuditUsername sets AuditUsername

func (Options) WithConfig

func (o Options) WithConfig(config string) Options

WithConfig sets config

func (Options) WithDetached

func (o Options) WithDetached(detached bool) Options

WithDetached sets immugw to be run in background

func (Options) WithDir

func (o Options) WithDir(dir string) Options

WithDir sets dir

func (Options) WithImmudbAddress

func (o Options) WithImmudbAddress(immudbAddress string) Options

WithImmudbAddress sets immudbAddress

func (Options) WithImmudbPort

func (o Options) WithImmudbPort(immudbPort int) Options

WithImmudbPort sets immudbPort

func (Options) WithLogfile

func (o Options) WithLogfile(logfile string) Options

WithLogfile sets logfile

func (Options) WithMTLs

func (o Options) WithMTLs(MTLs bool) Options

WithMTLs sets MTLs

func (Options) WithMTLsOptions

func (o Options) WithMTLsOptions(MTLsOptions client.MTLsOptions) Options

WithMTLsOptions sets MTLsOptions

func (Options) WithPidfile

func (o Options) WithPidfile(pidfile string) Options

WithPidfile sets pidfile

func (Options) WithPort

func (o Options) WithPort(port int) Options

WithPort sets port

type Runtime added in v0.7.0

Runtime ...

func DefaultRuntime added in v0.7.0

func DefaultRuntime() Runtime

DefaultRuntime ...

type SafeReferenceHandler

type SafeReferenceHandler interface {
	SafeReference(w http.ResponseWriter, req *http.Request, pathParams map[string]string)
}

SafeReferenceHandler ...

func NewSafeReferenceHandler

func NewSafeReferenceHandler(mux *runtime.ServeMux, client client.ImmuClient, rt Runtime, json json.JSON) SafeReferenceHandler

NewSafeReferenceHandler ...

type SafeZAddHandler

type SafeZAddHandler interface {
	SafeZAdd(w http.ResponseWriter, req *http.Request, pathParams map[string]string)
}

SafeZAddHandler ...

func NewSafeZAddHandler

func NewSafeZAddHandler(mux *runtime.ServeMux, client client.ImmuClient, rt Runtime, json json.JSON) SafeZAddHandler

NewSafeZAddHandler ...

type SafegetHandler

type SafegetHandler interface {
	Safeget(w http.ResponseWriter, req *http.Request, pathParams map[string]string)
}

SafegetHandler ...

func NewSafegetHandler

func NewSafegetHandler(mux *runtime.ServeMux, client client.ImmuClient, rt Runtime, json json.JSON) SafegetHandler

NewSafegetHandler ...

type SafesetHandler

type SafesetHandler interface {
	Safeset(w http.ResponseWriter, req *http.Request, pathParams map[string]string)
}

SafesetHandler ...

func NewSafesetHandler

func NewSafesetHandler(mux *runtime.ServeMux, client client.ImmuClient, rt Runtime, json json.JSON) SafesetHandler

NewSafesetHandler ...

type Service

type Service struct {
	ImmuGwServer ImmuGw
}

Service ...

func (Service) Run

func (s Service) Run()

Run - blocking run service

func (Service) Start

func (s Service) Start()

Start - non-blocking start service

func (Service) Stop

func (s Service) Stop()

Stop - non-blocking stop service

type SetHandler

type SetHandler interface {
	Set(w http.ResponseWriter, req *http.Request, pathParams map[string]string)
}

SetHandler ...

func NewSetHandler

func NewSetHandler(mux *runtime.ServeMux, client client.ImmuClient, rt Runtime, json json.JSON) SetHandler

NewSetHandler ...

type UseDatabaseHandler added in v0.7.0

type UseDatabaseHandler interface {
	UseDatabase(w http.ResponseWriter, req *http.Request, pathParams map[string]string)
}

UseDatabaseHandler ...

func NewUseDatabaseHandler added in v0.7.0

func NewUseDatabaseHandler(mux *runtime.ServeMux, client client.ImmuClient, rt Runtime, json json.JSON) UseDatabaseHandler

NewUseDatabaseHandler ...

Jump to

Keyboard shortcuts

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