Documentation ¶
Overview ¶
Package mongodb is an implementation of StateStore interface to perform operations on store
Index ¶
- func NewMongoDB(logger logger.Logger) state.Store
- type Item
- type MongoDB
- func (m *MongoDB) BulkDelete(ctx context.Context, req []state.DeleteRequest) error
- func (m *MongoDB) BulkGet(ctx context.Context, req []state.GetRequest, _ state.BulkGetOpts) ([]state.BulkGetResponse, error)
- func (m *MongoDB) BulkSet(ctx context.Context, req []state.SetRequest) error
- func (m *MongoDB) Delete(ctx context.Context, req *state.DeleteRequest) error
- func (m *MongoDB) Features() []state.Feature
- func (m *MongoDB) Get(ctx context.Context, req *state.GetRequest) (*state.GetResponse, error)
- func (m *MongoDB) GetComponentMetadata() map[string]string
- func (m *MongoDB) Init(ctx context.Context, metadata state.Metadata) (err error)
- func (m *MongoDB) Multi(ctx context.Context, request *state.TransactionalStateRequest) error
- func (m *MongoDB) Ping(ctx context.Context) error
- func (m *MongoDB) Query(ctx context.Context, req *state.QueryRequest) (*state.QueryResponse, error)
- func (m *MongoDB) Set(ctx context.Context, req *state.SetRequest) error
- type Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Item ¶
type Item struct { Key string `bson:"_id"` Value interface{} `bson:"value"` Etag string `bson:"_etag"` }
Item is Mongodb document wrapper.
type MongoDB ¶
type MongoDB struct {
// contains filtered or unexported fields
}
MongoDB is a state store implementation for MongoDB.
func (*MongoDB) BulkDelete ¶
BulkDelete performs a bulk delete operation. We need to implement a custom BulkSet/BulkDelete because with MongoDB transactions are not always available (only when connecting to a replica set), and when they're not, we need to fall back to performing operations in sequence.
func (*MongoDB) BulkGet ¶ added in v1.11.0
func (m *MongoDB) BulkGet(ctx context.Context, req []state.GetRequest, _ state.BulkGetOpts) ([]state.BulkGetResponse, error)
func (*MongoDB) BulkSet ¶
BulkSet performs a bulk save operation. We need to implement a custom BulkSet/BulkDelete because with MongoDB transactions are not always available (only when connecting to a replica set), and when they're not, we need to fall back to performing operations in sequence.
func (*MongoDB) Features ¶ added in v1.1.1
Features returns the features available in this state store.
func (*MongoDB) Get ¶
func (m *MongoDB) Get(ctx context.Context, req *state.GetRequest) (*state.GetResponse, error)
Get retrieves state from MongoDB with a key.
func (*MongoDB) GetComponentMetadata ¶ added in v1.10.1
func (*MongoDB) Multi ¶
Multi performs a transactional operation. succeeds only if all operations succeed, and fails if one or more operations fail.
func (*MongoDB) Query ¶ added in v1.5.0
func (m *MongoDB) Query(ctx context.Context, req *state.QueryRequest) (*state.QueryResponse, error)
Query executes a query against store.