Documentation
¶
Index ¶
- Constants
- Variables
- func IsAllowedDbName(dbName string) error
- func NewStateSigner(signer signer.Signer) *stateSigner
- func NewUUIDContext(id xid.ID) uuidContext
- func StartMetrics(addr string, l logger.Logger, recordsCounter func() float64, ...) *http.Server
- type CCOptions
- type CorruptionChecker
- type DatabaseList
- type ImmuServer
- func (s *ImmuServer) ChangePassword(ctx context.Context, r *schema.ChangePasswordRequest) (*empty.Empty, error)
- func (s *ImmuServer) ChangePermission(ctx context.Context, r *schema.ChangePermissionRequest) (*empty.Empty, error)
- func (s *ImmuServer) CloseDatabases() error
- func (s *ImmuServer) Count(ctx context.Context, prefix *schema.KeyPrefix) (*schema.EntryCount, error)
- func (s *ImmuServer) CountAll(ctx context.Context, e *empty.Empty) (*schema.EntryCount, error)
- func (s *ImmuServer) CreateDatabase(ctx context.Context, newdb *schema.Database) (*empty.Empty, error)
- func (s *ImmuServer) CreateUser(ctx context.Context, r *schema.CreateUserRequest) (*empty.Empty, error)
- func (s *ImmuServer) CurrentState(ctx context.Context, e *empty.Empty) (*schema.ImmutableState, error)
- func (s *ImmuServer) DatabaseList(ctx context.Context, req *empty.Empty) (*schema.DatabaseListResponse, error)
- func (s *ImmuServer) ExecAll(ctx context.Context, req *schema.ExecAllRequest) (*schema.TxMetadata, error)
- func (s *ImmuServer) Get(ctx context.Context, req *schema.KeyRequest) (*schema.Entry, error)
- func (s *ImmuServer) GetAll(ctx context.Context, req *schema.KeyListRequest) (*schema.Entries, error)
- func (s *ImmuServer) Health(ctx context.Context, e *empty.Empty) (*schema.HealthResponse, error)
- func (s *ImmuServer) History(ctx context.Context, req *schema.HistoryRequest) (*schema.Entries, error)
- func (s *ImmuServer) Initialize() error
- func (s *ImmuServer) ListUsers(ctx context.Context, req *empty.Empty) (*schema.UserList, error)
- func (s *ImmuServer) Login(ctx context.Context, r *schema.LoginRequest) (*schema.LoginResponse, error)
- func (s *ImmuServer) Logout(ctx context.Context, r *empty.Empty) (*empty.Empty, error)
- func (s *ImmuServer) PrintTree(ctx context.Context, r *empty.Empty) (*schema.Tree, error)
- func (s *ImmuServer) Scan(ctx context.Context, req *schema.ScanRequest) (*schema.Entries, error)
- func (s *ImmuServer) Set(ctx context.Context, kv *schema.SetRequest) (*schema.TxMetadata, error)
- func (s *ImmuServer) SetActiveUser(ctx context.Context, r *schema.SetActiveUserRequest) (*empty.Empty, error)
- func (s *ImmuServer) SetReference(ctx context.Context, req *schema.ReferenceRequest) (*schema.TxMetadata, error)
- func (s *ImmuServer) Start() (err error)
- func (s *ImmuServer) Stop() error
- func (s *ImmuServer) TxById(ctx context.Context, req *schema.TxRequest) (*schema.Tx, error)
- func (s *ImmuServer) UpdateAuthConfig(ctx context.Context, req *schema.AuthConfig) (*empty.Empty, error)
- func (s *ImmuServer) UpdateMTLSConfig(ctx context.Context, req *schema.MTLSConfig) (*empty.Empty, error)
- func (s *ImmuServer) UseDatabase(ctx context.Context, db *schema.Database) (*schema.UseDatabaseReply, error)
- func (s *ImmuServer) VerifiableGet(ctx context.Context, req *schema.VerifiableGetRequest) (*schema.VerifiableEntry, error)
- func (s *ImmuServer) VerifiableSet(ctx context.Context, req *schema.VerifiableSetRequest) (*schema.VerifiableTx, error)
- func (s *ImmuServer) VerifiableSetReference(ctx context.Context, req *schema.VerifiableReferenceRequest) (*schema.VerifiableTx, error)
- func (s *ImmuServer) VerifiableTxById(ctx context.Context, req *schema.VerifiableTxRequest) (*schema.VerifiableTx, error)
- func (s *ImmuServer) VerifiableZAdd(ctx context.Context, req *schema.VerifiableZAddRequest) (*schema.VerifiableTx, error)
- func (s *ImmuServer) WithLogger(logger logger.Logger) ImmuServerIf
- func (s *ImmuServer) WithOptions(options Options) ImmuServerIf
- func (s *ImmuServer) WithStateSigner(stateSigner StateSigner) ImmuServerIf
- func (s *ImmuServer) ZAdd(ctx context.Context, req *schema.ZAddRequest) (*schema.TxMetadata, error)
- func (s *ImmuServer) ZScan(ctx context.Context, req *schema.ZScanRequest) (*schema.ZEntries, error)
- type ImmuServerIf
- type MTLsOptions
- type MetricsCollection
- type Options
- func (o Options) Bind() string
- func (o Options) GetAuth() bool
- func (o Options) GetDefaultDbName() string
- func (o Options) GetMaintenance() bool
- func (o Options) GetSystemAdminDbName() string
- func (o Options) MetricsBind() string
- func (o Options) String() string
- func (o Options) WithAddress(address string) Options
- func (o Options) WithAdminPassword(adminPassword string) Options
- func (o Options) WithAuth(authEnabled bool) Options
- func (o Options) WithConfig(config string) Options
- func (o Options) WithCorruptionCheck(corruptionCheck bool) Options
- func (o Options) WithDetached(detached bool) Options
- func (o Options) WithDevMode(devMode bool) Options
- func (o Options) WithDir(dir string) Options
- func (o Options) WithListener(lis net.Listener) Options
- func (o Options) WithLogfile(logfile string) Options
- func (o Options) WithMTLs(MTLs bool) Options
- func (o Options) WithMTLsOptions(MTLsOptions MTLsOptions) Options
- func (o Options) WithMaintenance(m bool) Options
- func (o Options) WithMaxRecvMsgSize(maxRecvMsgSize int) Options
- func (o Options) WithMetricsServer(metricsServer bool) Options
- func (o Options) WithNetwork(network string) Options
- func (o Options) WithNoHistograms(noHistograms bool) Options
- func (o Options) WithPidfile(pidfile string) Options
- func (o Options) WithPort(port int) Options
- func (o Options) WithSigningKey(signingKey string) Options
- type PIDFile
- type RandomGenerator
- type Service
- type StateSigner
- type UUIDContext
- type WrappedServerStream
Constants ¶
const DefaultDbIndex = 0
DefaultDbIndex systemdb should always be in index 0
const DefaultdbName = "defaultdb"
const ErrConsistencyFail = "consistency check fail at index %d"
ErrConsistencyFail happens when a consistency check fails. Check the log to retrieve details on which element is failing
const IDENTIFIER_FNAME = "immudb.identifier"
IDENTIFIER_FNAME ...
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 )
const SERVER_UUID_HEADER = "immudb-uuid"
SERVER_UUID_HEADER ...
const SystemdbName = "systemdb"
Variables ¶
var ErrEmptyAdminPassword = fmt.Errorf("Admin password cannot be empty")
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"}, ), 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"}, ), }
Metrics immudb Prometheus metrics collection
Functions ¶
func IsAllowedDbName ¶ added in v0.7.0
IsAllowedDbName checks if the provided database name meets the requirements
func NewStateSigner ¶ added in v0.9.0
func NewUUIDContext ¶ added in v0.9.0
NewUUIDContext return a new UUId context servive
Types ¶
type CCOptions ¶ added in v0.7.0
type CCOptions struct {
// contains filtered or unexported fields
}
type CorruptionChecker ¶
CorruptionChecker corruption checker interface
func NewCorruptionChecker ¶
func NewCorruptionChecker(opt CCOptions, d DatabaseList, l logger.Logger, rg RandomGenerator) CorruptionChecker
NewCorruptionChecker returns new trust checker service
type DatabaseList ¶ added in v0.7.0
type DatabaseList interface {
Append(database database.DB)
GetByIndex(index int64) database.DB
Length() int
}
DatabaseList DatabaseList interface
func NewDatabaseList ¶ added in v0.7.0
func NewDatabaseList() DatabaseList
NewDatabaseList constructs a new database list
type ImmuServer ¶
type ImmuServer struct {
OS immuos.OS
Logger logger.Logger
Options Options
GrpcServer *grpc.Server
Pid PIDFile
Cc CorruptionChecker
StateSigner StateSigner
// contains filtered or unexported fields
}
ImmuServer ...
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) 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, e *empty.Empty) (*schema.EntryCount, error)
CountAll ...
func (*ImmuServer) CreateDatabase ¶ added in v0.7.0
func (s *ImmuServer) CreateDatabase(ctx context.Context, newdb *schema.Database) (*empty.Empty, error)
CreateDatabase 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, e *empty.Empty) (*schema.ImmutableState, error)
CurrentState ...
func (*ImmuServer) DatabaseList ¶ added in v0.7.0
func (s *ImmuServer) DatabaseList(ctx context.Context, req *empty.Empty) (*schema.DatabaseListResponse, error)
DatabaseList returns a list of databases based on the requesting user permissins
func (*ImmuServer) ExecAll ¶ added in v0.9.0
func (s *ImmuServer) ExecAll(ctx context.Context, req *schema.ExecAllRequest) (*schema.TxMetadata, error)
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
func (s *ImmuServer) GetAll(ctx context.Context, req *schema.KeyListRequest) (*schema.Entries, error)
GetAll ...
func (*ImmuServer) Health ¶
func (s *ImmuServer) Health(ctx context.Context, e *empty.Empty) (*schema.HealthResponse, error)
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) ListUsers ¶
ListUsers returns a list of users based on the requesting user permissions
func (*ImmuServer) Login ¶
func (s *ImmuServer) Login(ctx context.Context, r *schema.LoginRequest) (*schema.LoginResponse, error)
Login ...
func (*ImmuServer) Scan ¶
func (s *ImmuServer) Scan(ctx context.Context, req *schema.ScanRequest) (*schema.Entries, error)
Scan ...
func (*ImmuServer) Set ¶
func (s *ImmuServer) Set(ctx context.Context, kv *schema.SetRequest) (*schema.TxMetadata, error)
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.TxMetadata, 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) UpdateAuthConfig ¶
func (s *ImmuServer) UpdateAuthConfig(ctx context.Context, req *schema.AuthConfig) (*empty.Empty, error)
UpdateAuthConfig ...
func (*ImmuServer) UpdateMTLSConfig ¶
func (s *ImmuServer) UpdateMTLSConfig(ctx context.Context, req *schema.MTLSConfig) (*empty.Empty, error)
UpdateMTLSConfig ...
func (*ImmuServer) UseDatabase ¶ added in v0.7.0
func (s *ImmuServer) UseDatabase(ctx context.Context, db *schema.Database) (*schema.UseDatabaseReply, error)
UseDatabase ...
func (*ImmuServer) VerifiableGet ¶ added in v0.9.0
func (s *ImmuServer) VerifiableGet(ctx context.Context, req *schema.VerifiableGetRequest) (*schema.VerifiableEntry, error)
VerifiableGet ...
func (*ImmuServer) VerifiableSet ¶ added in v0.9.0
func (s *ImmuServer) VerifiableSet(ctx context.Context, req *schema.VerifiableSetRequest) (*schema.VerifiableTx, error)
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
func (s *ImmuServer) VerifiableZAdd(ctx context.Context, req *schema.VerifiableZAddRequest) (*schema.VerifiableTx, error)
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) WithStateSigner ¶ added in v0.9.0
func (s *ImmuServer) WithStateSigner(stateSigner StateSigner) ImmuServerIf
WithRootSigner ...
func (*ImmuServer) ZAdd ¶
func (s *ImmuServer) ZAdd(ctx context.Context, req *schema.ZAddRequest) (*schema.TxMetadata, error)
ZAdd ...
func (*ImmuServer) ZScan ¶
func (s *ImmuServer) ZScan(ctx context.Context, req *schema.ZScanRequest) (*schema.ZEntries, error)
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
}
type MTLsOptions ¶
MTLsOptions ...
func (MTLsOptions) WithCertificate ¶
func (o MTLsOptions) WithCertificate(Certificate string) MTLsOptions
WithCertificate ...
func (MTLsOptions) WithClientCAs ¶
func (o MTLsOptions) WithClientCAs(ClientCAs string) MTLsOptions
WithClientCAs ...
type MetricsCollection ¶
type MetricsCollection struct {
RecordsCounter prometheus.CounterFunc
UptimeCounter prometheus.CounterFunc
RPCsPerClientCounters *prometheus.CounterVec
LastMessageAtPerClientGauges *prometheus.GaugeVec
}
MetricsCollection immudb Prometheus metrics collection
func (*MetricsCollection) UpdateClientMetrics ¶
func (mc *MetricsCollection) UpdateClientMetrics(ctx context.Context)
UpdateClientMetrics ...
func (*MetricsCollection) WithRecordsCounter ¶
func (mc *MetricsCollection) WithRecordsCounter(f func() float64)
WithRecordsCounter ...
func (*MetricsCollection) WithUptimeCounter ¶
func (mc *MetricsCollection) WithUptimeCounter(f func() float64)
WithUptimeCounter ...
type Options ¶
type Options struct {
Dir string
Network string
Address string
Port int
MetricsPort int
Config string
Pidfile string
Logfile string
MTLs bool
MTLsOptions MTLsOptions
MaxRecvMsgSize int
NoHistograms bool
Detached bool
CorruptionCheck bool
MetricsServer bool
DevMode bool
AdminPassword string `json:"-"`
SigningKey string
// contains filtered or unexported fields
}
Options server options list
func (Options) GetDefaultDbName ¶ added in v0.7.0
GetDefaultDbName returns the default database name
func (Options) GetMaintenance ¶ added in v0.7.0
GetMaintenance gets maintenance mode
func (Options) GetSystemAdminDbName ¶ added in v0.7.0
GetSystemAdminDbName returns the System database name
func (Options) MetricsBind ¶
MetricsBind return metrics bind address
func (Options) WithAddress ¶
WithAddress sets address
func (Options) WithAdminPassword ¶ added in v0.6.2
WithAdminPassword ...
func (Options) WithConfig ¶
WithConfig sets config file name
func (Options) WithCorruptionCheck ¶
WithCorruptionCheck enable corruption check
func (Options) WithDetached ¶
WithDetached sets immudb to be run in background
func (Options) WithDevMode ¶ added in v0.6.2
WithDevMode ...
func (Options) WithListener ¶ added in v0.7.0
WithListener used usually to pass a bufered listener for testing purposes
func (Options) WithLogfile ¶
WithLogfile sets logfile
func (Options) WithMTLsOptions ¶
func (o Options) WithMTLsOptions(MTLsOptions MTLsOptions) Options
WithMTLsOptions sets WithMTLsOptions
func (Options) WithMaintenance ¶ added in v0.7.0
WithMaintenance sets maintenance mode
func (Options) WithMaxRecvMsgSize ¶ added in v0.8.1
func (Options) WithMetricsServer ¶
WithMetricsServer ...
func (Options) WithNetwork ¶
WithNetwork sets network
func (Options) WithNoHistograms ¶
WithNoHistograms disables collection of histograms metrics (e.g. query durations)
func (Options) WithPidfile ¶
WithPidfile sets pid file
func (Options) WithSigningKey ¶ added in v0.8.0
WithSigningKey sets signature private key
type PIDFile ¶
PIDFile contains path of pid file
type RandomGenerator ¶ added in v0.7.0
type RandomGenerator interface {
// contains filtered or unexported methods
}
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 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 ...