components-contrib/state
Shalabh Mohan Shrivastava 3ae5547e41 Adding MongoDB State Store Implementation (#53)
* Adding MongoDB State Store Implementation

Adding MongoDB State Store Implementation

* Fix bugs and add unit tests

* Adding write/read concerns

* go sum changes

* adding defer cancellation

* fixing the bug for default case override

* Resolving code review comment

* Adding go mod vendor files

* Fixing lint errors
2019-10-31 12:03:04 -07:00
..
cassandra Add github action for CI (#59) 2019-10-28 15:39:48 -07:00
consul state: initial version for the consul state store implementation (#52) 2019-10-25 21:34:16 -07:00
cosmosdb Add github action for CI (#59) 2019-10-28 15:39:48 -07:00
etcd Add github action for CI (#59) 2019-10-28 15:39:48 -07:00
memcached [WIP] Add memcached state store (#71) 2019-10-31 06:21:04 -07:00
mongodb Adding MongoDB State Store Implementation (#53) 2019-10-31 12:03:04 -07:00
redis Merge branch 'master' into state-fix 2019-10-29 16:55:12 -07:00
Readme.md [WIP] Add memcached state store (#71) 2019-10-31 06:21:04 -07:00
metadata.go Adding license header and updating to MIT license. (#26) 2019-10-09 10:58:08 -07:00
requests.go - adding more corrections 2019-10-10 18:16:08 -07:00
responses.go - adding more corrections 2019-10-10 18:16:08 -07:00
retry.go Add github action for CI (#59) 2019-10-28 15:39:48 -07:00
retry_test.go Add github action for CI (#59) 2019-10-28 15:39:48 -07:00
state_store.go Rename the StateStore interface (#70) 2019-10-30 17:44:47 -07:00
transactional_state_store.go Adding and Correcting code comments and types 2019-10-10 18:09:13 -07:00

Readme.md

State Stores

State Stores provide a common way to interact with different data store implementations, and allow users to opt-in to advanced capabilities using defined metadata.

Currently supported state stores are:

  • Redis
  • HashiCorp Consul
  • Etcd
  • Cassandra
  • Azure CosmosDB
  • Memcached

Implementing a new State Store

A compliant state store needs to implement one or more interfaces: StateStore and TransactionalStateStore.

The interface for StateStore:

type StateStore interface {
	Init(metadata Metadata) error
	Delete(req *DeleteRequest) error
	BulkDelete(req []DeleteRequest) error
	Get(req *GetRequest) (*GetResponse, error)
	Set(req *SetRequest) error
	BulkSet(req []SetRequest) error
}

The interface for TransactionalStateStore:

type TransactionalStateStore interface {
	Init(metadata Metadata) error
	Multi(reqs []TransactionalRequest) error
}

See the documentation repo for examples.