Documentation
¶
Index ¶
- Constants
- Variables
- func NewLcStateService(cache *FileCache, logger logger.Logger, stateProvider state.StateProvider, ...) (state.StateService, error)
- type ApiKeyAuth
- type FileCache
- func (w *FileCache) Get(serverUUID string, db string) (*schema.ImmutableState, error)
- func (w *FileCache) GetAndClean(serverUUID, db string) (*schema.ImmutableState, error)
- func (w *FileCache) Lock(serverUUID string) (err error)
- func (w *FileCache) Set(serverUUID string, db string, state *schema.ImmutableState) error
- func (w *FileCache) Unlock() (err error)
- type LcClient
- func (c *LcClient) ApiKeySetterInterceptor() ...
- func (c *LcClient) ApiKeySetterInterceptorStream() ...
- func (c *LcClient) Connect() (err error)
- func (c *LcClient) ConnectionCheckerInterceptor() ...
- func (c *LcClient) Disconnect() (err error)
- func (c *LcClient) ExecAll(ctx context.Context, in *immuschema.ExecAllRequest) (*immuschema.TxMetadata, error)
- func (c *LcClient) Feats(ctx context.Context) (*schema.Features, error)
- func (c *LcClient) Get(ctx context.Context, key []byte) (*immuschema.Entry, error)
- func (c *LcClient) GetAll(ctx context.Context, in *immuschema.KeyListRequest) (*immuschema.Entries, error)
- func (c *LcClient) GetAt(ctx context.Context, key []byte, tx uint64) (*immuschema.Entry, error)
- func (c *LcClient) GetFile(ctx context.Context, key []byte, filePath string) (*immuschema.Entry, error)
- func (c *LcClient) Health(ctx context.Context) (*immuschema.HealthResponse, error)
- func (c *LcClient) History(ctx context.Context, req *immuschema.HistoryRequest) (*immuschema.Entries, error)
- func (c *LcClient) HistoryExt(ctx context.Context, options *immuschema.HistoryRequest) (*schema.ItemExtList, error)
- func (c *LcClient) Scan(ctx context.Context, req *immuschema.ScanRequest) (*immuschema.Entries, error)
- func (c *LcClient) Set(ctx context.Context, key []byte, value []byte) (*immuschema.TxMetadata, error)
- func (c *LcClient) SetAll(ctx context.Context, req *immuschema.SetRequest) (*immuschema.TxMetadata, error)
- func (c *LcClient) SetFile(ctx context.Context, key []byte, filePath string) (*immuschema.TxMetadata, error)
- func (c *LcClient) SignatureVerifierInterceptor(ctx context.Context, method string, req, reply interface{}, ...) error
- func (c *LcClient) StreamExecAll(ctx context.Context, req *stream.ExecAllRequest) (*schema.TxMetadata, error)
- func (c *LcClient) StreamGet(ctx context.Context, k *immuschema.KeyRequest) (*immuschema.Entry, error)
- func (c *LcClient) StreamHistory(ctx context.Context, req *immuschema.HistoryRequest) (*immuschema.Entries, error)
- func (c *LcClient) StreamScan(ctx context.Context, req *immuschema.ScanRequest) (*immuschema.Entries, error)
- func (c *LcClient) StreamSet(ctx context.Context, kvs []*stream.KeyValue) (*immuschema.TxMetadata, error)
- func (c *LcClient) StreamVerifiedGet(ctx context.Context, req *immuschema.VerifiableGetRequest) (*immuschema.Entry, error)
- func (c *LcClient) StreamVerifiedSet(ctx context.Context, kvs []*stream.KeyValue) (*immuschema.TxMetadata, error)
- func (c *LcClient) StreamZScan(ctx context.Context, req *immuschema.ZScanRequest) (*immuschema.ZEntries, error)
- func (c *LcClient) VerifiedGet(ctx context.Context, key []byte) (*immuschema.Entry, error)
- func (c *LcClient) VerifiedGetAt(ctx context.Context, key []byte, tx uint64) (*immuschema.Entry, error)
- func (c *LcClient) VerifiedGetExt(ctx context.Context, key []byte) (itemExt *schema.VerifiableItemExt, err error)
- func (c *LcClient) VerifiedGetExtAt(ctx context.Context, key []byte, tx uint64) (itemExt *schema.VerifiableItemExt, err error)
- func (c *LcClient) VerifiedGetExtSince(ctx context.Context, key []byte, tx uint64) (itemExt *schema.VerifiableItemExt, err error)
- func (c *LcClient) VerifiedGetSince(ctx context.Context, key []byte, tx uint64) (*immuschema.Entry, error)
- func (c *LcClient) VerifiedSet(ctx context.Context, key []byte, value []byte) (*immuschema.TxMetadata, error)
- func (c *LcClient) ZAddAt(ctx context.Context, options *immuschema.ZAddRequest) (*immuschema.TxMetadata, error)
- func (c *LcClient) ZScan(ctx context.Context, req *immuschema.ZScanRequest) (*immuschema.ZEntries, error)
- func (c *LcClient) ZScanExt(ctx context.Context, options *immuschema.ZScanRequest) (*schema.ZItemExtList, error)
- type LcClientIf
- type LcClientOption
- func ApiKey(apiKey string) LcClientOption
- func ClientConn(clientConn *grpc.ClientConn) LcClientOption
- func DialOptions(dopts []grpc.DialOption) LcClientOption
- func Dir(c string) LcClientOption
- func Host(c string) LcClientOption
- func Logger(logger logger.Logger) LcClientOption
- func MetadataPairs(metadataPairs []string) LcClientOption
- func Port(port int) LcClientOption
- func ServerSigningPubKey(serverSigningPubKey *ecdsa.PublicKey) LcClientOption
- func ServiceClient(serviceClient schema.LcServiceClient) LcClientOption
- func StateService(rootservice state.StateService) LcClientOption
- func TimestampService(timestampService immuclient.TimestampService) LcClientOption
- type LcStateProvider
- type LcUuidProvider
Constants ¶
const MaxCallRecvMsgSize = 32 << 20
const STATE_FN = ".state-"
STATE_FN ...
Variables ¶
var ErrCacheAlreadyLocked = fmt.Errorf("cache is already locked")
var ErrCacheNotLocked = fmt.Errorf("cache is not locked")
var ErrLocalStateCorrupted = fmt.Errorf("local state is corrupted")
var ErrNoServerUuid = fmt.Errorf( "!IMPORTANT WARNING: %s header is not published by the immudb server; "+ "this client MUST NOT be used to connect to different immudb servers!", server.SERVER_UUID_HEADER)
ErrNoServerUuid ...
var ErrPrevStateNotFound = fmt.Errorf("could not find previous state")
var ErrStateNotFound = fmt.Errorf("could not find previous state")
Functions ¶
func NewLcStateService ¶ added in v0.9.1
func NewLcStateService(cache *FileCache, logger logger.Logger, stateProvider state.StateProvider, uuidProvider state.UUIDProvider) (state.StateService, error)
NewLcStateService ...
Types ¶
type ApiKeyAuth ¶
type ApiKeyAuth struct {
ApiKey string
}
func (ApiKeyAuth) GetRequestMetadata ¶
func (ApiKeyAuth) RequireTransportSecurity ¶
func (ApiKeyAuth) RequireTransportSecurity() bool
type FileCache ¶ added in v0.9.1
type FileCache struct { Dir string // contains filtered or unexported fields }
func NewLcFileCache ¶ added in v0.9.1
NewFileCache returns a new file cache
func (*FileCache) GetAndClean ¶ added in v0.9.1
func (w *FileCache) GetAndClean(serverUUID, db string) (*schema.ImmutableState, error)
GetAndClean retrieve the state for db identifier and remove it from state file
type LcClient ¶
type LcClient struct { Dir string Host string Port int ApiKey string MetadataPairs []string DialOptions []grpc.DialOption Logger logger.Logger ClientConn *grpc.ClientConn ServiceClient schema.LcServiceClient StateService state.StateService TimestampService immuclient.TimestampService StreamChunkSize int StreamServiceFactory stream.ServiceFactory sync.RWMutex // contains filtered or unexported fields }
func NewLcClient ¶
func NewLcClient(setters ...LcClientOption) *LcClient
func (*LcClient) ApiKeySetterInterceptor ¶
func (c *LcClient) ApiKeySetterInterceptor() func(context.Context, string, interface{}, interface{}, *grpc.ClientConn, grpc.UnaryInvoker, ...grpc.CallOption) error
func (*LcClient) ApiKeySetterInterceptorStream ¶ added in v0.9.2
func (c *LcClient) ApiKeySetterInterceptorStream() func(context.Context, *grpc.StreamDesc, *grpc.ClientConn, string, grpc.Streamer, ...grpc.CallOption) (grpc.ClientStream, error)
ApiKeySetterInterceptorStream ...
func (*LcClient) ConnectionCheckerInterceptor ¶
func (c *LcClient) ConnectionCheckerInterceptor() func(context.Context, string, interface{}, interface{}, *grpc.ClientConn, grpc.UnaryInvoker, ...grpc.CallOption) error
func (*LcClient) Disconnect ¶
func (*LcClient) ExecAll ¶ added in v0.9.1
func (c *LcClient) ExecAll(ctx context.Context, in *immuschema.ExecAllRequest) (*immuschema.TxMetadata, error)
ExecAll ...
func (*LcClient) GetAll ¶ added in v0.9.1
func (c *LcClient) GetAll(ctx context.Context, in *immuschema.KeyListRequest) (*immuschema.Entries, error)
GetAll ...
func (*LcClient) GetFile ¶ added in v0.9.2
func (c *LcClient) GetFile(ctx context.Context, key []byte, filePath string) (*immuschema.Entry, error)
GetFile ...
func (*LcClient) Health ¶ added in v0.9.1
func (c *LcClient) Health(ctx context.Context) (*immuschema.HealthResponse, error)
func (*LcClient) History ¶
func (c *LcClient) History(ctx context.Context, req *immuschema.HistoryRequest) (*immuschema.Entries, error)
History ...
func (*LcClient) HistoryExt ¶
func (c *LcClient) HistoryExt(ctx context.Context, options *immuschema.HistoryRequest) (*schema.ItemExtList, error)
HistoryExt ...
func (*LcClient) Scan ¶
func (c *LcClient) Scan(ctx context.Context, req *immuschema.ScanRequest) (*immuschema.Entries, error)
Scan ...
func (*LcClient) Set ¶
func (c *LcClient) Set(ctx context.Context, key []byte, value []byte) (*immuschema.TxMetadata, error)
Set ...
func (*LcClient) SetAll ¶ added in v0.9.2
func (c *LcClient) SetAll(ctx context.Context, req *immuschema.SetRequest) (*immuschema.TxMetadata, error)
func (*LcClient) SetFile ¶ added in v0.9.2
func (c *LcClient) SetFile(ctx context.Context, key []byte, filePath string) (*immuschema.TxMetadata, error)
SetFile ...
func (*LcClient) SignatureVerifierInterceptor ¶ added in v0.9.1
func (c *LcClient) SignatureVerifierInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
SignatureVerifierInterceptor verify that provided server signature match with the public key provided
func (*LcClient) StreamExecAll ¶ added in v0.9.2
func (c *LcClient) StreamExecAll(ctx context.Context, req *stream.ExecAllRequest) (*schema.TxMetadata, error)
StreamExecAll ...
func (*LcClient) StreamGet ¶ added in v0.9.2
func (c *LcClient) StreamGet(ctx context.Context, k *immuschema.KeyRequest) (*immuschema.Entry, error)
StreamGet ...
func (*LcClient) StreamHistory ¶ added in v0.9.2
func (c *LcClient) StreamHistory(ctx context.Context, req *immuschema.HistoryRequest) (*immuschema.Entries, error)
StreamHistory ...
func (*LcClient) StreamScan ¶ added in v0.9.2
func (c *LcClient) StreamScan(ctx context.Context, req *immuschema.ScanRequest) (*immuschema.Entries, error)
StreamScan ...
func (*LcClient) StreamSet ¶ added in v0.9.2
func (c *LcClient) StreamSet(ctx context.Context, kvs []*stream.KeyValue) (*immuschema.TxMetadata, error)
StreamSet ...
func (*LcClient) StreamVerifiedGet ¶ added in v0.9.2
func (c *LcClient) StreamVerifiedGet(ctx context.Context, req *immuschema.VerifiableGetRequest) (*immuschema.Entry, error)
StreamVerifiedGet ...
func (*LcClient) StreamVerifiedSet ¶ added in v0.9.2
func (c *LcClient) StreamVerifiedSet(ctx context.Context, kvs []*stream.KeyValue) (*immuschema.TxMetadata, error)
StreamVerifiedSet ...
func (*LcClient) StreamZScan ¶ added in v0.9.2
func (c *LcClient) StreamZScan(ctx context.Context, req *immuschema.ZScanRequest) (*immuschema.ZEntries, error)
StreamZScan ...
func (*LcClient) VerifiedGet ¶ added in v0.9.1
VerifiedGet ...
func (*LcClient) VerifiedGetAt ¶ added in v0.9.1
func (c *LcClient) VerifiedGetAt(ctx context.Context, key []byte, tx uint64) (*immuschema.Entry, error)
VerifiedGetAt ...
func (*LcClient) VerifiedGetExt ¶ added in v0.9.1
func (c *LcClient) VerifiedGetExt(ctx context.Context, key []byte) (itemExt *schema.VerifiableItemExt, err error)
VerifiedGetExt ...
func (*LcClient) VerifiedGetExtAt ¶ added in v0.9.1
func (c *LcClient) VerifiedGetExtAt(ctx context.Context, key []byte, tx uint64) (itemExt *schema.VerifiableItemExt, err error)
VerifiedGetExtAt ...
func (*LcClient) VerifiedGetExtSince ¶ added in v0.9.1
func (c *LcClient) VerifiedGetExtSince(ctx context.Context, key []byte, tx uint64) (itemExt *schema.VerifiableItemExt, err error)
VerifiedGetExtSince ...
func (*LcClient) VerifiedGetSince ¶ added in v0.9.1
func (c *LcClient) VerifiedGetSince(ctx context.Context, key []byte, tx uint64) (*immuschema.Entry, error)
VerifiedGetSince ...
func (*LcClient) VerifiedSet ¶ added in v0.9.1
func (c *LcClient) VerifiedSet(ctx context.Context, key []byte, value []byte) (*immuschema.TxMetadata, error)
VerifiedSet ...
func (*LcClient) ZAddAt ¶ added in v0.9.1
func (c *LcClient) ZAddAt(ctx context.Context, options *immuschema.ZAddRequest) (*immuschema.TxMetadata, error)
ZAddAt ...
func (*LcClient) ZScan ¶
func (c *LcClient) ZScan(ctx context.Context, req *immuschema.ZScanRequest) (*immuschema.ZEntries, error)
ZScan ...
func (*LcClient) ZScanExt ¶
func (c *LcClient) ZScanExt(ctx context.Context, options *immuschema.ZScanRequest) (*schema.ZItemExtList, error)
ZScanExt ...
type LcClientIf ¶
type LcClientIf interface { Set(ctx context.Context, key []byte, value []byte) (*immuschema.TxMetadata, error) VerifiedSet(ctx context.Context, key []byte, value []byte) (*immuschema.TxMetadata, error) Get(ctx context.Context, key []byte) (*immuschema.Entry, error) GetAt(ctx context.Context, key []byte, tx uint64) (*immuschema.Entry, error) VerifiedGet(ctx context.Context, key []byte) (*immuschema.Entry, error) VerifiedGetSince(ctx context.Context, key []byte, tx uint64) (*immuschema.Entry, error) VerifiedGetAt(ctx context.Context, key []byte, tx uint64) (*immuschema.Entry, error) GetAll(ctx context.Context, in *immuschema.KeyListRequest) (*immuschema.Entries, error) SetAll(ctx context.Context, kvList *immuschema.SetRequest) (*immuschema.TxMetadata, error) ExecAll(ctx context.Context, in *immuschema.ExecAllRequest) (*immuschema.TxMetadata, error) Scan(ctx context.Context, req *immuschema.ScanRequest) (*immuschema.Entries, error) ZScan(ctx context.Context, req *immuschema.ZScanRequest) (*immuschema.ZEntries, error) History(ctx context.Context, req *immuschema.HistoryRequest) (*immuschema.Entries, error) ZScanExt(ctx context.Context, options *immuschema.ZScanRequest) (*schema.ZItemExtList, error) HistoryExt(ctx context.Context, options *immuschema.HistoryRequest) (sl *schema.ItemExtList, err error) Feats(ctx context.Context, in *empty.Empty) (*schema.Features, error) Health(ctx context.Context) (*immuschema.HealthResponse, error) VerifiedGetExt(ctx context.Context, key []byte) (*schema.VerifiableItemExt, error) VerifiedGetExtSince(ctx context.Context, key []byte, tx uint64) (*schema.VerifiableItemExt, error) VerifiedGetExtAt(ctx context.Context, key []byte, tx uint64) (itemExt *schema.VerifiableItemExt, err error) SetFile(ctx context.Context, key []byte, filePath string) (*immuschema.TxMetadata, error) GetFile(ctx context.Context, key []byte, filePath string) (*immuschema.Entry, error) Connect() (err error) // streams StreamSet(ctx context.Context, kvs []*stream.KeyValue) (*immuschema.TxMetadata, error) StreamGet(ctx context.Context, k *immuschema.KeyRequest) (*immuschema.Entry, error) StreamVerifiedSet(ctx context.Context, kvs []*stream.KeyValue) (*immuschema.TxMetadata, error) StreamVerifiedGet(ctx context.Context, req *immuschema.VerifiableGetRequest) (*immuschema.Entry, error) StreamScan(ctx context.Context, req *immuschema.ScanRequest) (*immuschema.Entries, error) StreamZScan(ctx context.Context, req *immuschema.ZScanRequest) (*immuschema.ZEntries, error) StreamHistory(ctx context.Context, req *immuschema.HistoryRequest) (*immuschema.Entries, error) StreamExecAll(ctx context.Context, req *stream.ExecAllRequest) (*immuschema.TxMetadata, error) }
LcClientIf ...
type LcClientOption ¶
type LcClientOption func(*LcClient)
func ApiKey ¶
func ApiKey(apiKey string) LcClientOption
func ClientConn ¶
func ClientConn(clientConn *grpc.ClientConn) LcClientOption
func DialOptions ¶
func DialOptions(dopts []grpc.DialOption) LcClientOption
func Dir ¶
func Dir(c string) LcClientOption
func Host ¶
func Host(c string) LcClientOption
func Logger ¶
func Logger(logger logger.Logger) LcClientOption
func MetadataPairs ¶ added in v0.9.2
func MetadataPairs(metadataPairs []string) LcClientOption
func Port ¶
func Port(port int) LcClientOption
func ServerSigningPubKey ¶ added in v0.9.1
func ServerSigningPubKey(serverSigningPubKey *ecdsa.PublicKey) LcClientOption
func ServiceClient ¶
func ServiceClient(serviceClient schema.LcServiceClient) LcClientOption
func StateService ¶ added in v0.9.1
func StateService(rootservice state.StateService) LcClientOption
func TimestampService ¶
func TimestampService(timestampService immuclient.TimestampService) LcClientOption
type LcStateProvider ¶ added in v0.9.1
type LcStateProvider struct {
// contains filtered or unexported fields
}
func NewLcStateProvider ¶ added in v0.9.1
func NewLcStateProvider(client schema.LcServiceClient) *LcStateProvider
func (LcStateProvider) CurrentState ¶ added in v0.9.1
func (r LcStateProvider) CurrentState(ctx context.Context) (*immuschema.ImmutableState, error)
type LcUuidProvider ¶
type LcUuidProvider struct {
// contains filtered or unexported fields
}
func NewLcUUIDProvider ¶
func NewLcUUIDProvider(client schema.LcServiceClient) *LcUuidProvider
func (LcUuidProvider) CurrentUUID ¶
func (r LcUuidProvider) CurrentUUID(ctx context.Context) (string, error)
CurrentUuid issues a Health command to the server, then parses and returns the server UUID from the response metadata