store

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStore

func GetStore(ocisOpts OcisStoreOptions) store.Store

Get the configured key-value store to be used.

Each microservice (or whatever piece is using the store) should use the options available in the interface's operations to choose the right database and table to prevent collisions with other microservices. Recommended approach is to use "services" or "ocis-pkg" for the database, and "services/<service-name>/" or "ocis-pkg/<pkg>/" for the package name.

So far, only the name of the store and the node addresses are configurable via environment variables. Available options for "OCIS_STORE" are: * "noop", for a noop store (it does nothing) * "etcd", for etcd * "ocmem", custom in-memory implementation, with fixed size and optimized prefix and suffix search * "memory", for a in-memory implementation, which is the default if noone matches

"OCIS_STORE_ADDRESS" is a comma-separated list of nodes that the store will use. This is currently usable only with the etcd implementation. If it isn't provided, "127.0.0.1:2379" will be the only node used.

"OCIS_STORE_OCMEM_SIZE" will configure the maximum capacity of the cache for the "ocmem" implementation, in number of items that the cache can hold per table. You can use "OCIS_STORE_OCMEM_SIZE=5000" so the cache will hold up to 5000 elements. The parameter only affects to the "ocmem" implementation, the rest will ignore it. If an invalid value is used, the default will be used instead, so up to 512 elements the cache will hold.

Types

type OcisStoreOptions

type OcisStoreOptions struct {
	Type    string
	Address string
	Size    int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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