server

package
v1.3.2-RC1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 63 Imported by: 4

Documentation

Overview

Copyright 2022 Codenotary Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 Codenotary Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 Codenotary Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 Codenotary Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 Codenotary Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 Codenotary Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	//KeyPrefixUser All user keys in the key/value store are prefixed by this keys to distinguish them from keys that have other purposes
	KeyPrefixUser = iota + 1
	//KeyPrefixDBSettings is used for entries related to database settings
	KeyPrefixDBSettings
)
View Source
const DefaultDBName = "defaultdb"
View Source
const DefaultMaxValueLen = 1 << 25 //32Mb
View Source
const DefaultStoreFileSize = 1 << 29 //512Mb
View Source
const IDENTIFIER_FNAME = "immudb.identifier"

IDENTIFIER_FNAME ...

View Source
const SERVER_UUID_HEADER = "immudb-uuid"

SERVER_UUID_HEADER ...

View Source
const SystemDBName = "systemdb"

Variables

View Source
var (
	ErrIllegalArguments            = status.Error(codes.InvalidArgument, database.ErrIllegalArguments.Error())
	ErrIllegalState                = status.Error(codes.InvalidArgument, database.ErrIllegalState.Error())
	ErrEmptyAdminPassword          = status.Error(codes.InvalidArgument, "Admin password cannot be empty")
	ErrUserNotActive               = "user is not active"
	ErrInvalidUsernameOrPassword   = "invalid user name or password"
	ErrAuthDisabled                = "server is running with authentication disabled, please enable authentication to login"
	ErrAuthMustBeEnabled           = status.Error(codes.InvalidArgument, "authentication must be on")
	ErrAuthMustBeDisabled          = status.Error(codes.InvalidArgument, "authentication must be disabled when restoring systemdb")
	ErrNotAllowedInMaintenanceMode = status.Error(codes.InvalidArgument, "operation not allowed in maintenance mode")
	ErrReservedDatabase            = errors.New("database is reserved")
	ErrPermissionDenied            = errors.New("permission denied")
	ErrNotSupported                = errors.New("operation not supported")
	ErrNotLoggedIn                 = auth.ErrNotLoggedIn
	ErrReplicationInProgress       = errors.New("replication already in progress")
	ErrReplicatorNotNeeded         = errors.New("replicator is not needed")
	ErrReplicationNotInProgress    = errors.New("replication is not in progress")
	ErrSessionAlreadyPresent       = errors.New("session already present").WithCode(errors.CodInternalError)
	ErrSessionNotFound             = errors.New("session not found").WithCode(errors.CodSqlserverRejectedEstablishmentOfSqlSession)
	ErrOngoingReadWriteTx          = sessions.ErrOngoingReadWriteTx
	ErrNoSessionIDPresent          = errors.New("no sessionID provided")
	ErrTxNotProperlyClosed         = errors.New("tx not properly closed")
	ErrReadWriteTxNotOngoing       = errors.New("read write transaction not ongoing")
	ErrTxReadConflict              = errors.New(store.ErrTxReadConflict.Error()).WithCode(errors.CodInFailedSqlTransaction)
	ErrDatabaseAlreadyLoaded       = errors.New("database already loaded")
)
View Source
var (
	ErrRemoteStorageDoesNotMatch = errors.New("remote storage does not match local files")
)
View Source
var Metrics = MetricsCollection{
	RPCsPerClientCounters: promauto.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: metricsNamespace,
			Name:      "number_of_rpcs_per_client",
			Help:      "Number of handled RPCs per client.",
		},
		[]string{"ip"},
	),
	DBSizeGauges: promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: metricsNamespace,
			Name:      "db_size_bytes",
			Help:      "Database size in bytes.",
		},
		[]string{"db"},
	),
	DBEntriesGauges: promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: metricsNamespace,
			Name:      "number_of_stored_entries",
			Help:      "Number of key-value entries currently stored by the database.",
		},
		[]string{"db"},
	),
	LastMessageAtPerClientGauges: promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: metricsNamespace,
			Name:      "clients_last_message_at_unix_seconds",
			Help:      "Timestamp at which clients have sent their most recent message.",
		},
		[]string{"ip"},
	),
	RemoteStorageKind: promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: metricsNamespace,
			Name:      "remote_storage_kind",
			Help:      "Set to 1 for remote storage kind for given database",
		},
		[]string{"db", "kind"},
	),
}

Metrics immudb Prometheus metrics collection

Functions

func ErrorMapper added in v0.9.2

func ErrorMapper(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

ErrorMapper map standard errors in gRPC errors

func ErrorMapperStream added in v0.9.2

func ErrorMapperStream(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

ErrorMapperStream map standard errors in gRPC errors

func ImmudbHealthHandlerFunc added in v1.0.5

func ImmudbHealthHandlerFunc() http.HandlerFunc

func ImmudbVersionHandlerFunc added in v1.0.5

func ImmudbVersionHandlerFunc(w http.ResponseWriter, r *http.Request)

func NewStateSigner added in v0.9.0

func NewStateSigner(signer signer.Signer) *stateSigner

func NewUUIDContext added in v0.9.0

func NewUUIDContext(id xid.ID) uuidContext

NewUUIDContext return a new UUId context servive

func StartMetrics

func StartMetrics(
	updateInterval time.Duration,
	addr string,
	l logger.Logger,
	uptimeCounter func() float64,
	computeDBSizes func() map[string]float64,
	computeDBEntries func() map[string]float64,
	addPProf bool,
) *http.Server

StartMetrics listens and servers the HTTP metrics server in a new goroutine. The server is then returned and can be stopped using Close().

func StartWebServer added in v1.0.0

func StartWebServer(addr string, tlsConfig *tls.Config, s schema.ImmuServiceServer, l logger.Logger) (*http.Server, error)

Types

type ImmuServer

type ImmuServer struct {
	OS immuos.OS

	Logger     logger.Logger
	Options    *Options
	Listener   net.Listener
	GrpcServer *grpc.Server
	UUID       xid.ID
	Pid        PIDFile

	StateSigner          StateSigner
	StreamServiceFactory stream.ServiceFactory
	PgsqlSrv             pgsqlsrv.Server

	SessManager sessions.Manager
	// contains filtered or unexported fields
}

ImmuServer ...

func DefaultServer

func DefaultServer() *ImmuServer

DefaultServer ...

func (*ImmuServer) ChangePassword

func (s *ImmuServer) ChangePassword(ctx context.Context, r *schema.ChangePasswordRequest) (*empty.Empty, error)

ChangePassword ...

func (*ImmuServer) ChangePermission added in v0.7.0

func (s *ImmuServer) ChangePermission(ctx context.Context, r *schema.ChangePermissionRequest) (*empty.Empty, error)

ChangePermission grant or revoke user permissions on databases

func (*ImmuServer) CloseDatabases added in v0.7.0

func (s *ImmuServer) CloseDatabases() error

CloseDatabases closes all opened databases including the consinstency checker

func (*ImmuServer) CloseSession added in v1.2.0

func (s *ImmuServer) CloseSession(ctx context.Context, _ *empty.Empty) (*empty.Empty, error)

func (*ImmuServer) Commit added in v1.2.0

func (*ImmuServer) CompactIndex added in v1.0.5

func (s *ImmuServer) CompactIndex(ctx context.Context, _ *empty.Empty) (*empty.Empty, error)

func (*ImmuServer) Count

func (s *ImmuServer) Count(ctx context.Context, prefix *schema.KeyPrefix) (*schema.EntryCount, error)

Count ...

func (*ImmuServer) CountAll added in v0.8.1

func (s *ImmuServer) CountAll(ctx context.Context, _ *empty.Empty) (*schema.EntryCount, error)

CountAll ...

func (*ImmuServer) CreateDatabase added in v0.7.0

func (s *ImmuServer) CreateDatabase(ctx context.Context, req *schema.Database) (*empty.Empty, error)

CreateDatabase Create a new database instance

func (*ImmuServer) CreateDatabaseV2 added in v1.2.3

func (s *ImmuServer) CreateDatabaseV2(ctx context.Context, req *schema.CreateDatabaseRequest) (res *schema.CreateDatabaseResponse, err error)

CreateDatabaseV2 Create a new database instance

func (*ImmuServer) CreateDatabaseWith added in v1.0.5

func (s *ImmuServer) CreateDatabaseWith(ctx context.Context, req *schema.DatabaseSettings) (*empty.Empty, error)

CreateDatabaseWith Create a new database instance

func (*ImmuServer) CreateUser

func (s *ImmuServer) CreateUser(ctx context.Context, r *schema.CreateUserRequest) (*empty.Empty, error)

CreateUser Creates a new user

func (*ImmuServer) CurrentState added in v0.9.0

func (s *ImmuServer) CurrentState(ctx context.Context, _ *empty.Empty) (*schema.ImmutableState, error)

CurrentState ...

func (*ImmuServer) DatabaseHealth added in v1.2.3

func (s *ImmuServer) DatabaseHealth(ctx context.Context, _ *empty.Empty) (*schema.DatabaseHealthResponse, error)

func (*ImmuServer) DatabaseList added in v0.7.0

func (s *ImmuServer) DatabaseList(ctx context.Context, _ *empty.Empty) (*schema.DatabaseListResponse, error)

DatabaseList returns a list of databases based on the requesting user permissions

func (*ImmuServer) DatabaseListV2 added in v1.2.3

DatabaseList returns a list of databases based on the requesting user permissions

func (*ImmuServer) Delete added in v1.2.0

func (*ImmuServer) DeleteDatabase added in v1.2.3

func (s *ImmuServer) DeleteDatabase(ctx context.Context, req *schema.DeleteDatabaseRequest) (res *schema.DeleteDatabaseResponse, err error)

func (*ImmuServer) DescribeTable added in v1.0.0

func (s *ImmuServer) DescribeTable(ctx context.Context, req *schema.Table) (*schema.SQLQueryResult, error)

func (*ImmuServer) ExecAll added in v0.9.0

func (s *ImmuServer) ExecAll(ctx context.Context, req *schema.ExecAllRequest) (*schema.TxHeader, error)

func (*ImmuServer) ExportTx added in v1.0.5

func (*ImmuServer) FlushIndex added in v1.2.3

func (*ImmuServer) Get

func (s *ImmuServer) Get(ctx context.Context, req *schema.KeyRequest) (*schema.Entry, error)

Get ...

func (*ImmuServer) GetAll added in v0.9.0

GetAll ...

func (*ImmuServer) GetDatabaseSettings added in v1.2.3

func (s *ImmuServer) GetDatabaseSettings(ctx context.Context, _ *empty.Empty) (*schema.DatabaseSettings, error)

func (*ImmuServer) GetDatabaseSettingsV2 added in v1.2.3

func (*ImmuServer) Health

Health ...

func (*ImmuServer) History

func (s *ImmuServer) History(ctx context.Context, req *schema.HistoryRequest) (*schema.Entries, error)

History ...

func (*ImmuServer) Initialize added in v0.9.0

func (s *ImmuServer) Initialize() error

Initialize initializes dependencies, set up multi database capabilities and stats

func (*ImmuServer) KeepALiveSessionStreamInterceptor added in v1.2.0

func (s *ImmuServer) KeepALiveSessionStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func (*ImmuServer) KeepAlive added in v1.2.0

func (s *ImmuServer) KeepAlive(ctx context.Context, e *empty.Empty) (*empty.Empty, error)

KeepAlive is catched by KeepAliveSessionInterceptor

func (*ImmuServer) KeepAliveSessionInterceptor added in v1.2.0

func (s *ImmuServer) KeepAliveSessionInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

func (*ImmuServer) ListTables added in v1.0.0

func (s *ImmuServer) ListTables(ctx context.Context, _ *empty.Empty) (*schema.SQLQueryResult, error)

func (*ImmuServer) ListUsers

func (s *ImmuServer) ListUsers(ctx context.Context, req *empty.Empty) (*schema.UserList, error)

ListUsers returns a list of users based on the requesting user permissions

func (*ImmuServer) LoadDatabase added in v1.2.3

func (s *ImmuServer) LoadDatabase(ctx context.Context, req *schema.LoadDatabaseRequest) (res *schema.LoadDatabaseResponse, err error)

func (*ImmuServer) Login

Login ...

func (*ImmuServer) Logout added in v0.6.1

func (s *ImmuServer) Logout(ctx context.Context, r *empty.Empty) (*empty.Empty, error)

Logout ...

func (*ImmuServer) NewTx added in v1.2.0

func (s *ImmuServer) NewTx(ctx context.Context, request *schema.NewTxRequest) (*schema.NewTxResponse, error)

BeginTx creates a new transaction. Only one read-write transaction per session can be active at a time.

func (*ImmuServer) OpenSession added in v1.2.0

func (*ImmuServer) ReplicateTx added in v1.0.5

func (s *ImmuServer) ReplicateTx(replicateTxServer schema.ImmuService_ReplicateTxServer) error

func (*ImmuServer) Rollback added in v1.2.0

func (s *ImmuServer) Rollback(ctx context.Context, _ *empty.Empty) (*empty.Empty, error)

func (*ImmuServer) SQLExec added in v1.0.0

func (*ImmuServer) SQLQuery added in v1.0.0

func (*ImmuServer) Scan

Scan ...

func (*ImmuServer) ServerInfo added in v1.3.2

ServerInfo returns information about the server instance.

func (*ImmuServer) SessionAuthInterceptor added in v1.2.0

func (s *ImmuServer) SessionAuthInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

func (*ImmuServer) Set

Set ...

func (*ImmuServer) SetActiveUser added in v0.7.0

func (s *ImmuServer) SetActiveUser(ctx context.Context, r *schema.SetActiveUserRequest) (*empty.Empty, error)

SetActiveUser activate or deactivate a user

func (*ImmuServer) SetReference added in v0.9.0

func (s *ImmuServer) SetReference(ctx context.Context, req *schema.ReferenceRequest) (*schema.TxHeader, error)

SetReference ...

func (*ImmuServer) Start

func (s *ImmuServer) Start() (err error)

Start starts the immudb server Loads and starts the System DB, default db and user db

func (*ImmuServer) Stop

func (s *ImmuServer) Stop() error

Stop stops the immudb server

func (*ImmuServer) StreamExecAll added in v0.9.2

func (*ImmuServer) StreamGet added in v0.9.2

StreamGet return a stream of key-values to the client

func (*ImmuServer) StreamHistory added in v0.9.2

func (s *ImmuServer) StreamHistory(request *schema.HistoryRequest, server schema.ImmuService_StreamHistoryServer) error

func (*ImmuServer) StreamScan added in v0.9.2

func (*ImmuServer) StreamSet added in v0.9.2

StreamSet set a stream of key-values in the internal store

func (*ImmuServer) StreamVerifiableGet added in v0.9.2

StreamVerifiableGet ...

func (*ImmuServer) StreamVerifiableSet added in v0.9.2

func (s *ImmuServer) StreamVerifiableSet(str schema.ImmuService_StreamVerifiableSetServer) error

StreamVerifiableSet ...

func (*ImmuServer) StreamZScan added in v0.9.2

func (s *ImmuServer) StreamZScan(request *schema.ZScanRequest, server schema.ImmuService_StreamZScanServer) error

StreamZScan ...

func (*ImmuServer) TxById added in v0.9.0

func (s *ImmuServer) TxById(ctx context.Context, req *schema.TxRequest) (*schema.Tx, error)

TxByID ...

func (*ImmuServer) TxSQLExec added in v1.2.0

func (s *ImmuServer) TxSQLExec(ctx context.Context, request *schema.SQLExecRequest) (*empty.Empty, error)

func (*ImmuServer) TxSQLQuery added in v1.2.0

func (s *ImmuServer) TxSQLQuery(ctx context.Context, request *schema.SQLQueryRequest) (*schema.SQLQueryResult, error)

func (*ImmuServer) TxScan added in v0.9.1

func (s *ImmuServer) TxScan(ctx context.Context, req *schema.TxScanRequest) (*schema.TxList, error)

TxScan ...

func (*ImmuServer) UnloadDatabase added in v1.2.3

func (s *ImmuServer) UnloadDatabase(ctx context.Context, req *schema.UnloadDatabaseRequest) (res *schema.UnloadDatabaseResponse, err error)

func (*ImmuServer) UpdateAuthConfig

func (s *ImmuServer) UpdateAuthConfig(ctx context.Context, req *schema.AuthConfig) (*empty.Empty, error)

UpdateAuthConfig is DEPRECATED

func (*ImmuServer) UpdateDatabase added in v1.0.5

func (s *ImmuServer) UpdateDatabase(ctx context.Context, req *schema.DatabaseSettings) (*empty.Empty, error)

UpdateDatabase Updates database settings

func (*ImmuServer) UpdateDatabaseV2 added in v1.2.3

func (s *ImmuServer) UpdateDatabaseV2(ctx context.Context, req *schema.UpdateDatabaseRequest) (res *schema.UpdateDatabaseResponse, err error)

UpdateDatabaseV2 Updates database settings

func (*ImmuServer) UpdateMTLSConfig

func (s *ImmuServer) UpdateMTLSConfig(ctx context.Context, req *schema.MTLSConfig) (*empty.Empty, error)

UpdateMTLSConfig is DEPRECATED

func (*ImmuServer) UseDatabase added in v0.7.0

func (s *ImmuServer) UseDatabase(ctx context.Context, req *schema.Database) (*schema.UseDatabaseReply, error)

UseDatabase ...

func (*ImmuServer) VerifiableGet added in v0.9.0

VerifiableGet ...

func (*ImmuServer) VerifiableSQLGet added in v1.0.0

func (*ImmuServer) VerifiableSet added in v0.9.0

VerifiableSet ...

func (*ImmuServer) VerifiableSetReference added in v0.9.0

func (s *ImmuServer) VerifiableSetReference(ctx context.Context, req *schema.VerifiableReferenceRequest) (*schema.VerifiableTx, error)

VerifibleSetReference ...

func (*ImmuServer) VerifiableTxById added in v0.9.0

func (s *ImmuServer) VerifiableTxById(ctx context.Context, req *schema.VerifiableTxRequest) (*schema.VerifiableTx, error)

VerifiableTxByID ...

func (*ImmuServer) VerifiableZAdd added in v0.9.0

VerifiableZAdd ...

func (*ImmuServer) WithLogger

func (s *ImmuServer) WithLogger(logger logger.Logger) ImmuServerIf

WithLogger ...

func (*ImmuServer) WithOptions

func (s *ImmuServer) WithOptions(options *Options) ImmuServerIf

WithOptions ...

func (*ImmuServer) WithPgsqlServer added in v1.0.0

func (s *ImmuServer) WithPgsqlServer(psrv pgsqlsrv.Server) ImmuServerIf

WithPgsqlServer ...

func (*ImmuServer) WithStateSigner added in v0.9.0

func (s *ImmuServer) WithStateSigner(stateSigner StateSigner) ImmuServerIf

WithStateSigner ...

func (*ImmuServer) WithStreamServiceFactory added in v0.9.2

func (s *ImmuServer) WithStreamServiceFactory(ssf stream.ServiceFactory) ImmuServerIf

func (*ImmuServer) ZAdd

ZAdd ...

func (*ImmuServer) ZScan

ZScan ...

type ImmuServerIf added in v0.7.0

type ImmuServerIf interface {
	Initialize() error
	Start() error
	Stop() error
	WithOptions(options *Options) ImmuServerIf
	WithLogger(logger.Logger) ImmuServerIf
	WithStateSigner(stateSigner StateSigner) ImmuServerIf
	WithStreamServiceFactory(ssf stream.ServiceFactory) ImmuServerIf
	WithPgsqlServer(psrv pgsqlsrv.Server) ImmuServerIf
}

type MetricsCollection

type MetricsCollection struct {
	UptimeCounter prometheus.CounterFunc

	DBSizeGauges *prometheus.GaugeVec

	DBEntriesGauges *prometheus.GaugeVec

	RPCsPerClientCounters        *prometheus.CounterVec
	LastMessageAtPerClientGauges *prometheus.GaugeVec

	RemoteStorageKind *prometheus.GaugeVec
	// contains filtered or unexported fields
}

MetricsCollection immudb Prometheus metrics collection

func (*MetricsCollection) UpdateClientMetrics

func (mc *MetricsCollection) UpdateClientMetrics(ctx context.Context)

UpdateClientMetrics ...

func (*MetricsCollection) UpdateDBMetrics added in v1.0.0

func (mc *MetricsCollection) UpdateDBMetrics()

UpdateDBMetrics ...

func (*MetricsCollection) WithComputeDBEntries added in v1.0.0

func (mc *MetricsCollection) WithComputeDBEntries(f func() map[string]float64)

WithComputeDBEntries ...

func (*MetricsCollection) WithComputeDBSizes added in v1.0.0

func (mc *MetricsCollection) WithComputeDBSizes(f func() map[string]float64)

WithComputeDBSizes ...

func (*MetricsCollection) WithUptimeCounter

func (mc *MetricsCollection) WithUptimeCounter(f func() float64)

WithUptimeCounter ...

type Milliseconds added in v1.3.2

type Milliseconds int64

type Options

type Options struct {
	Dir       string
	Network   string
	Address   string
	Port      int
	Config    string
	Pidfile   string
	Logfile   string
	TLSConfig *tls.Config

	MaxRecvMsgSize    int
	NoHistograms      bool
	Detached          bool
	MetricsServer     bool
	MetricsServerPort int
	WebServer         bool
	WebServerPort     int
	DevMode           bool
	AdminPassword     string `json:"-"`

	SigningKey string

	RemoteStorageOptions *RemoteStorageOptions
	StreamChunkSize      int
	TokenExpiryTimeMin   int
	PgsqlServer          bool
	PgsqlServerPort      int
	ReplicationOptions   *ReplicationOptions
	SessionsOptions      *sessions.Options
	PProf                bool
	LogFormat            string
	// contains filtered or unexported fields
}

Options server options list

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns default server options

func (*Options) Bind

func (o *Options) Bind() string

Bind returns bind address

func (*Options) GetAuth added in v0.7.0

func (o *Options) GetAuth() bool

GetAuth gets auth Deprecated: GetAuth will be removed in future release

func (*Options) GetDefaultDBName added in v1.1.0

func (o *Options) GetDefaultDBName() string

GetDefaultDBName returns the default database name

func (*Options) GetMaintenance added in v0.7.0

func (o *Options) GetMaintenance() bool

GetMaintenance gets maintenance mode

func (*Options) GetSynced added in v1.1.0

func (o *Options) GetSynced() bool

GetSynced gets synced mode

func (*Options) GetSystemAdminDBName added in v1.1.0

func (o *Options) GetSystemAdminDBName() string

GetSystemAdminDBName returns the System database name

func (*Options) IsFileLogger added in v1.3.2

func (o *Options) IsFileLogger() bool

IsFileLogger returns if the log format is to a file

func (*Options) IsJSONLogger added in v1.3.2

func (o *Options) IsJSONLogger() bool

IsJSONLogger returns if the log format is json

func (*Options) MetricsBind

func (o *Options) MetricsBind() string

MetricsBind return metrics bind address

func (*Options) String

func (o *Options) String() string

String print options

func (*Options) WebBind added in v1.0.0

func (o *Options) WebBind() string

WebBind return bind address for the Web API/console

func (*Options) WithAddress

func (o *Options) WithAddress(address string) *Options

WithAddress sets address

func (*Options) WithAdminPassword added in v0.6.2

func (o *Options) WithAdminPassword(adminPassword string) *Options

WithAdminPassword ...

func (*Options) WithAuth

func (o *Options) WithAuth(authEnabled bool) *Options

WithAuth sets auth Deprecated: WithAuth will be removed in future release

func (*Options) WithConfig

func (o *Options) WithConfig(config string) *Options

WithConfig sets config file name

func (*Options) WithDetached

func (o *Options) WithDetached(detached bool) *Options

WithDetached sets immudb to be run in background

func (*Options) WithDevMode added in v0.6.2

func (o *Options) WithDevMode(devMode bool) *Options

WithDevMode ...

func (*Options) WithDir

func (o *Options) WithDir(dir string) *Options

WithDir sets dir

func (*Options) WithListener added in v0.7.0

func (o *Options) WithListener(lis net.Listener) *Options

WithListener used usually to pass a bufered listener for testing purposes

func (*Options) WithLogFormat added in v1.3.2

func (o *Options) WithLogFormat(logFormat string) *Options

func (*Options) WithLogfile

func (o *Options) WithLogfile(logfile string) *Options

WithLogfile sets logfile

func (*Options) WithMaintenance added in v0.7.0

func (o *Options) WithMaintenance(m bool) *Options

WithMaintenance sets maintenance mode

func (*Options) WithMaxRecvMsgSize added in v0.8.1

func (o *Options) WithMaxRecvMsgSize(maxRecvMsgSize int) *Options

func (*Options) WithMetricsServer

func (o *Options) WithMetricsServer(metricsServer bool) *Options

WithMetricsServer ...

func (*Options) WithMetricsServerPort added in v1.3.1

func (o *Options) WithMetricsServerPort(port int) *Options

MetricsPort set Prometheus end-point port

func (*Options) WithNetwork

func (o *Options) WithNetwork(network string) *Options

WithNetwork sets network

func (*Options) WithNoHistograms

func (o *Options) WithNoHistograms(noHistograms bool) *Options

WithNoHistograms disables collection of histograms metrics (e.g. query durations)

func (*Options) WithPProf added in v1.3.2

func (o *Options) WithPProf(pprof bool) *Options

func (*Options) WithPgsqlServer added in v1.0.0

func (o *Options) WithPgsqlServer(enable bool) *Options

PgsqlServerPort enable or disable pgsql server

func (*Options) WithPgsqlServerPort added in v1.0.0

func (o *Options) WithPgsqlServerPort(port int) *Options

PgsqlServerPort sets pgdsql server port

func (*Options) WithPidfile

func (o *Options) WithPidfile(pidfile string) *Options

WithPidfile sets pid file

func (*Options) WithPort

func (o *Options) WithPort(port int) *Options

WithPort sets port

func (*Options) WithRemoteStorageOptions added in v1.0.5

func (o *Options) WithRemoteStorageOptions(remoteStorageOptions *RemoteStorageOptions) *Options

func (*Options) WithReplicationOptions added in v1.1.0

func (o *Options) WithReplicationOptions(replicationOptions *ReplicationOptions) *Options

func (*Options) WithSessionOptions added in v1.2.0

func (o *Options) WithSessionOptions(options *sessions.Options) *Options

func (*Options) WithSigningKey added in v0.8.0

func (o *Options) WithSigningKey(signingKey string) *Options

WithSigningKey sets signature private key

func (*Options) WithStreamChunkSize added in v0.9.2

func (o *Options) WithStreamChunkSize(streamChunkSize int) *Options

WithStreamChunkSize set the chunk size

func (*Options) WithSynced added in v1.1.0

func (o *Options) WithSynced(synced bool) *Options

WithSynced sets synced mode

func (*Options) WithTLS added in v1.0.0

func (o *Options) WithTLS(tls *tls.Config) *Options

WithTLS sets tls config

func (*Options) WithTokenExpiryTime added in v1.0.0

func (o *Options) WithTokenExpiryTime(tokenExpiryTimeMin int) *Options

WithTokenExpiryTime set authentication token expiration time in minutes

func (*Options) WithWebServer added in v1.0.0

func (o *Options) WithWebServer(webServer bool) *Options

WithWebServer ...

func (*Options) WithWebServerPort added in v1.0.0

func (o *Options) WithWebServerPort(port int) *Options

WithWebServerPort ...

type PIDFile

type PIDFile struct {
	OS immuos.OS
	// contains filtered or unexported fields
}

PIDFile contains path of pid file

func NewPid

func NewPid(path string, OS immuos.OS) (PIDFile, error)

NewPid returns a new PIDFile or an error

func (PIDFile) Remove

func (file PIDFile) Remove() error

Remove remove the pid file

type RemoteStorageOptions added in v1.0.5

type RemoteStorageOptions struct {
	S3Storage     bool
	S3Endpoint    string
	S3AccessKeyID string
	S3SecretKey   string `json:"-"`
	S3BucketName  string
	S3Location    string
	S3PathPrefix  string
}

func DefaultRemoteStorageOptions added in v1.0.5

func DefaultRemoteStorageOptions() *RemoteStorageOptions

func (*RemoteStorageOptions) WithS3AccessKeyID added in v1.0.5

func (opts *RemoteStorageOptions) WithS3AccessKeyID(s3AccessKeyID string) *RemoteStorageOptions

func (*RemoteStorageOptions) WithS3BucketName added in v1.0.5

func (opts *RemoteStorageOptions) WithS3BucketName(s3BucketName string) *RemoteStorageOptions

func (*RemoteStorageOptions) WithS3Endpoint added in v1.0.5

func (opts *RemoteStorageOptions) WithS3Endpoint(s3Endpoint string) *RemoteStorageOptions

func (*RemoteStorageOptions) WithS3Location added in v1.2.2

func (opts *RemoteStorageOptions) WithS3Location(s3Location string) *RemoteStorageOptions

func (*RemoteStorageOptions) WithS3PathPrefix added in v1.0.5

func (opts *RemoteStorageOptions) WithS3PathPrefix(s3PathPrefix string) *RemoteStorageOptions

func (*RemoteStorageOptions) WithS3SecretKey added in v1.0.5

func (opts *RemoteStorageOptions) WithS3SecretKey(s3SecretKey string) *RemoteStorageOptions

func (*RemoteStorageOptions) WithS3Storage added in v1.0.5

func (opts *RemoteStorageOptions) WithS3Storage(S3Storage bool) *RemoteStorageOptions

type ReplicationOptions added in v1.1.0

type ReplicationOptions struct {
	MasterAddress    string
	MasterPort       int
	FollowerUsername string
	FollowerPassword string
}

func (*ReplicationOptions) WithFollowerPassword added in v1.1.0

func (opts *ReplicationOptions) WithFollowerPassword(followerPassword string) *ReplicationOptions

func (*ReplicationOptions) WithFollowerUsername added in v1.1.0

func (opts *ReplicationOptions) WithFollowerUsername(followerUsername string) *ReplicationOptions

func (*ReplicationOptions) WithMasterAddress added in v1.1.0

func (opts *ReplicationOptions) WithMasterAddress(masterAddress string) *ReplicationOptions

func (*ReplicationOptions) WithMasterPort added in v1.1.0

func (opts *ReplicationOptions) WithMasterPort(masterPort int) *ReplicationOptions

type Service

type Service struct {
	ImmuServerIf
}

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 StateSigner added in v0.9.0

type StateSigner interface {
	Sign(state *schema.ImmutableState) error
}

type UUIDContext

type UUIDContext interface {
	UUIDStreamContextSetter(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
	UUIDContextSetter(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
}

UUIDContext manage UUID context

type VersionResponse added in v1.0.5

type VersionResponse struct {
	Component string `json:"component" example:"immudb"`
	Version   string `json:"version" example:"1.0.1-c9c6495"`
	BuildTime string `json:"buildtime" example:"1604692129"`
	BuiltBy   string `json:"builtby,omitempty"`
	Static    bool   `json:"static"`
}

VersionResponse ...

var Version VersionResponse

type WrappedServerStream

type WrappedServerStream struct {
	grpc.ServerStream
}

WrappedServerStream ...

func (*WrappedServerStream) RecvMsg

func (w *WrappedServerStream) RecvMsg(m interface{}) error

RecvMsg ...

func (*WrappedServerStream) SendMsg

func (w *WrappedServerStream) SendMsg(m interface{}) error

SendMsg ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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