ikvclient

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BUCKET_NAME string = "ikv-binaries"
View Source
var EMPTY_STRING string = ""
View Source
var REGION string = "us-west-2"

Functions

This section is empty.

Types

type BinaryManager added in v0.0.13

type BinaryManager struct {
	// contains filtered or unexported fields
}

Manages native IKV binaries for dynamic loading.

func NewBinaryManager added in v0.0.13

func NewBinaryManager(mount_dir string) (*BinaryManager, error)

func (*BinaryManager) GetPathToNativeBinary added in v0.0.13

func (manager *BinaryManager) GetPathToNativeBinary() (string, error)

type ClientOptions

type ClientOptions struct {
	// contains filtered or unexported fields
}

https://docs.inlined.io/clients/go-guide#configuration Use `ClientOptionsBuilder` to create ClientOptions

type ClientOptionsBuilder

type ClientOptionsBuilder struct {
	// contains filtered or unexported fields
}

https://docs.inlined.io/clients/go-guide#configuration Initialize with NewClientOptionsBuilder(), specify options with various `WithFoo()` functions, and build `ClientOptions` by calling Build().

func NewClientOptionsBuilder

func NewClientOptionsBuilder() *ClientOptionsBuilder

Create a new options builder.

func (*ClientOptionsBuilder) Build

func (builder *ClientOptionsBuilder) Build() (ClientOptions, error)

Create ClientOptions.

func (*ClientOptionsBuilder) WithAccountId

func (builder *ClientOptionsBuilder) WithAccountId(accountId string) *ClientOptionsBuilder

func (*ClientOptionsBuilder) WithAccountPasskey

func (builder *ClientOptionsBuilder) WithAccountPasskey(accountPasskey string) *ClientOptionsBuilder

func (*ClientOptionsBuilder) WithConsoleLogging

func (builder *ClientOptionsBuilder) WithConsoleLogging(level string) *ClientOptionsBuilder

func (*ClientOptionsBuilder) WithFileLogging

func (builder *ClientOptionsBuilder) WithFileLogging(filepath string, level string) *ClientOptionsBuilder

func (*ClientOptionsBuilder) WithKafkaPropertyOverride

func (builder *ClientOptionsBuilder) WithKafkaPropertyOverride(key string, value string) *ClientOptionsBuilder

Ex. withKafkaPropertyOverride("ssl.ca.location", "/etc/ssl/certs") is required on Ubuntu hosts to declare CA certificates.

func (*ClientOptionsBuilder) WithMountDirectory

func (builder *ClientOptionsBuilder) WithMountDirectory(dir string) *ClientOptionsBuilder

func (*ClientOptionsBuilder) WithStoreName

func (builder *ClientOptionsBuilder) WithStoreName(name string) *ClientOptionsBuilder

type DefaultIKVReader

type DefaultIKVReader struct {
	// contains filtered or unexported fields
}

func (*DefaultIKVReader) GetBytesValue

func (reader *DefaultIKVReader) GetBytesValue(primaryKey interface{}, fieldname string) (bool, []byte, error)

func (*DefaultIKVReader) GetStringValue

func (reader *DefaultIKVReader) GetStringValue(primaryKey interface{}, fieldname string) (bool, string, error)

func (*DefaultIKVReader) HealthCheck added in v0.0.12

func (reader *DefaultIKVReader) HealthCheck() (bool, error)

func (*DefaultIKVReader) MultiGetBytesValues added in v0.0.25

func (reader *DefaultIKVReader) MultiGetBytesValues(primaryKeys []interface{}, fieldNames []string) ([][]byte, error)

func (*DefaultIKVReader) Shutdown

func (reader *DefaultIKVReader) Shutdown() error

Shutdown. Reader invokes shutdown sequence on the embedded index via cgo.

func (*DefaultIKVReader) Startup

func (reader *DefaultIKVReader) Startup() error

Startup. Reader fetches and combines server/client configs and opens embedded index via cgo.

type DefaultIKVWriter

type DefaultIKVWriter struct {
	// contains filtered or unexported fields
}

func NewDefaultIKVWriter

func NewDefaultIKVWriter(clientOptions *ClientOptions) (*DefaultIKVWriter, error)

Constructor for creating new instances.

func (*DefaultIKVWriter) DeleteDocument added in v0.0.14

func (writer *DefaultIKVWriter) DeleteDocument(document *IKVDocument) error

func (*DefaultIKVWriter) DeleteFields added in v0.0.14

func (writer *DefaultIKVWriter) DeleteFields(document *IKVDocument, fieldsToDelete []string) error

func (*DefaultIKVWriter) DropAllFields added in v0.0.20

func (writer *DefaultIKVWriter) DropAllFields() error

func (*DefaultIKVWriter) DropFieldsByName added in v0.0.20

func (writer *DefaultIKVWriter) DropFieldsByName(fieldNames []string) error

func (*DefaultIKVWriter) DropFieldsByNamePrefix added in v0.0.20

func (writer *DefaultIKVWriter) DropFieldsByNamePrefix(fieldNamePrefixes []string) error

func (*DefaultIKVWriter) HealthCheck added in v0.0.12

func (writer *DefaultIKVWriter) HealthCheck() (bool, error)

HealthCheck implements IKVWriter.

func (*DefaultIKVWriter) Helloworld

func (writer *DefaultIKVWriter) Helloworld(input string) (*schemas.HelloWorldResponse, error)

func (*DefaultIKVWriter) Shutdown

func (writer *DefaultIKVWriter) Shutdown() error

Shutdown. Teardown connection.

func (*DefaultIKVWriter) Startup

func (writer *DefaultIKVWriter) Startup() error

Startup. Connection initialization.

func (*DefaultIKVWriter) UpsertFields

func (writer *DefaultIKVWriter) UpsertFields(document *IKVDocument) error

Upsert. Publish a document.

type IKVClientFactory

type IKVClientFactory struct {
}

Factory for creating reader/writer clients. See `ClientOptions` struct to specify client configuration.

func (*IKVClientFactory) CreateNewReader

func (f *IKVClientFactory) CreateNewReader(clientOptions *ClientOptions) (IKVReader, error)

Create new IKV reader instance.

func (*IKVClientFactory) CreateNewWriter

func (f *IKVClientFactory) CreateNewWriter(clientOptions *ClientOptions) (IKVWriter, error)

Create new IKV writer instance.

type IKVDocument

type IKVDocument struct {
	// contains filtered or unexported fields
}

Represents an indexable document for IKV (collection of fields associated with a primary key). See IKVDocumentBuilder to build documents.

type IKVDocumentBuilder

type IKVDocumentBuilder struct {
	// contains filtered or unexported fields
}

func NewIKVDocumentBuilder

func NewIKVDocumentBuilder() *IKVDocumentBuilder

Constructor for a new document builder.

func (*IKVDocumentBuilder) Build

func (builder *IKVDocumentBuilder) Build() (IKVDocument, error)

Build this document.

func (*IKVDocumentBuilder) PutBytesField

func (builder *IKVDocumentBuilder) PutBytesField(fieldname string, value []byte) *IKVDocumentBuilder

Insert a bytes field.

func (*IKVDocumentBuilder) PutStringField

func (builder *IKVDocumentBuilder) PutStringField(fieldname string, value string) *IKVDocumentBuilder

Insert a string field.

type IKVReader

type IKVReader interface {
	// Blocking startup, initializes the embedded store by pulling latest data locally.
	// Do not invoke other functions before startup is finished.
	Startup() error

	// Shutdown embedded store - ex. during application exit.
	Shutdown() error

	// Fetch an inner field of type []byte, by providing the primary-key
	// for the document and the field-name.
	//
	// Return values: bool (if the field exists for the document), the value, optional error
	//
	// Field types are set during upsert operations on IKVWriter. Reading a field in a type different
	// than its written type can have unintended results.
	//
	// Please note IKV readers are eventually-consistent in terms of "reading your writes".
	// There can be a very small delay between writing document (with IKVWriter) and reading them.
	GetBytesValue(primaryKey interface{}, fieldname string) (bool, []byte, error)

	// Multi-get version of GetBytesValue (multiple primary-keys and multiple fields).
	//
	// Args:
	// primaryKeys - documents to fetch fields for, of type string or []byte, nil not allowed
	// fieldNames - fields to fetch as a slice of string
	//
	// Returns field values as slice of byte slices, in document order, i.e:
	// [doc0-field0][doc0-field1]..[doc0-fieldN][doc1-field0][doc1-field1]...[docN-fieldN]
	// The inner byte slices will be nil ([]byte(nil)) if the field does not exist for the document.
	MultiGetBytesValues(primaryKeys []interface{}, fieldNames []string) ([][]byte, error)

	// Fetch an inner field of type string, by providing the primary-key
	// for the document and the field-name.
	//
	// Return values: bool (if the field exists for the document), the value, optional error
	//
	// Field types are set during upsert operations on IKVWriter. Reading a field in a type different
	// than its written type can have unintended results.
	//
	// Please note IKV readers are eventually-consistent in terms of "reading your writes".
	// There can be a very small delay between writing document (with IKVWriter) and reading them.
	GetStringValue(primaryKey interface{}, fieldname string) (bool, string, error)

	HealthCheck() (bool, error)
}

Reader client over a provisioned IKV store. You should reuse an instantiated client as it holds an embedded database instance. Lifecycle (startup/shutdown) of a reader client should be tied with application lifecycle.

See IKVClientFactory to create a new instance.

func NewDefaultIKVReader added in v0.0.12

func NewDefaultIKVReader(clientOptions *ClientOptions) (IKVReader, error)

type IKVWriter

type IKVWriter interface {
	// Blocking startup, initializes the writer client.
	// Do not invoke other functions before startup is finished.
	Startup() error

	// Shutdown writer client - ex. during application exit.
	Shutdown() error

	// Upsert (insert or update) fields for a document.
	// Provided `document` must contain the value of the primary-key and (if-applicable) partitioning-key.
	//
	// Different values for the same primary-key are aggregated by unionizing distincts and overwriting duplicates. Example -
	// upsert: {"pkey": 0, "key1": "value1"}, followed by upsert: {"pkey": 0, "key1": "value100", "key2": "value2"}
	// results in {"pkey": 0, "key1": "value100", "key2": "value2"} being saved.
	UpsertFields(document *IKVDocument) error

	// Delete specified fields from a document. NO OP if document or any field in `fieldsToDelete` does not exist.
	// Provided `document` must contain the value of the primary-key and (if-applicable) partitioning-key.
	DeleteFields(document *IKVDocument, fieldsToDelete []string) error

	// Delete a document (i.e. all of its fields) if it exists. NO OP if `document` is not indexed.
	// Provided `document` must contain the value of the primary-key and (if-applicable) partitioning-key.
	DeleteDocument(document *IKVDocument) error

	// Drop specified fields for all documents.
	// Attempts to drop primary-key field are silently ignored (no error).
	DropFieldsByName(fieldNames []string) error

	// Drop specified fields for all documents, by specifying field name prefixes.
	// Attempts to drop primary-key field are silently ignored (no error).
	DropFieldsByNamePrefix(fieldNamePrefixes []string) error

	// Drop all documents from the store.
	DropAllFields() error

	HealthCheck() (bool, error)
}

Writer client over a provisioned IKV store. You should reuse an instantiated client. Lifecycle (startup/shutdown) of a reader client should be tied with application lifecycle.

See IKVClientFactory to create a new instance.

type NativeReaderV2 added in v0.0.13

type NativeReaderV2 struct {
	// contains filtered or unexported fields
}

func NewNativeReaderV2 added in v0.0.13

func NewNativeReaderV2(dllPath string) (*NativeReaderV2, error)

func (*NativeReaderV2) Close added in v0.0.13

func (nr *NativeReaderV2) Close() error

func (*NativeReaderV2) GetFieldValue added in v0.0.13

func (nr *NativeReaderV2) GetFieldValue(primaryKey []byte, fieldName string) []byte

returns nil []byte if value does not exist ("empty")

func (*NativeReaderV2) HealthCheck added in v0.0.13

func (nr *NativeReaderV2) HealthCheck(input string) (bool, error)

func (*NativeReaderV2) MultiGetFieldValues added in v0.0.25

func (nr *NativeReaderV2) MultiGetFieldValues(numPrimaryKeys int32, sizePrefixedPrimaryKeys []byte, fieldNames []string) ([][]byte, error)

func (*NativeReaderV2) Open added in v0.0.13

func (nr *NativeReaderV2) Open(config []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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