couchdb

package module
v0.0.0-...-1a43f7c Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 17

Documentation

Overview

Package couchdb implements a storage interface for Aries (aries-framework-go).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadinessCheck

func ReadinessCheck(url string) error

ReadinessCheck performs a readiness check on the CouchDB instance located at url.

Types

type Option

type Option func(opts *Provider)

Option represents an option for a CouchDB Provider.

func WithDBPrefix

func WithDBPrefix(dbPrefix string) Option

WithDBPrefix is an option for adding a prefix to all created DB names.

func WithLogger

func WithLogger(logger logger) Option

WithLogger is an option for specifying a custom logger. The standard Golang logger will be used if this option is not provided.

func WithMaxDocumentConflictRetries

func WithMaxDocumentConflictRetries(maxRetries int) Option

WithMaxDocumentConflictRetries is an option for specifying how many retries are allowed when there's a document update conflict. This can happen if there are multiple CouchDB providers trying to insert data into a store or set store configs are the same time. maxRetries must be > 0. If not set (or set to an invalid value), it will default to 3 in the NewProvider function.

type Provider

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

Provider represents a CouchDB implementation of the storage.Provider interface.

func NewProvider

func NewProvider(hostURL string, opts ...Option) (*Provider, error)

NewProvider instantiates a new CouchDB Provider. TODO (#48): Allow context to be passed in.

func (*Provider) Close

func (p *Provider) Close() error

Close closes the provider.

func (*Provider) GetOpenStores

func (p *Provider) GetOpenStores() []storage.Store

GetOpenStores returns all currently open stores.

func (*Provider) GetStoreConfig

func (p *Provider) GetStoreConfig(name string) (storage.StoreConfiguration, error)

GetStoreConfig gets the current store configuration.

func (*Provider) OpenStore

func (p *Provider) OpenStore(name string) (storage.Store, error)

OpenStore opens a store with the given name and returns a handle. If the store has never been opened before, then it is created.

func (*Provider) Ping

func (p *Provider) Ping() error

Ping verifies whether the CouchDB client can successfully connect to the deployment specified by the host URL string used in the NewProvider call.

func (*Provider) SetStoreConfig

func (p *Provider) SetStoreConfig(name string, config storage.StoreConfiguration) error

SetStoreConfig sets the configuration on a store. Indexes are created based on the tag names in config. This allows the store.Query method to operate faster with large datasets. If you want to do queries with sorts, then you must ensure the tag you're sorting on is indexed, otherwise the query will fail. Existing tag names/indexes in the store that are not in the config passed in here will be removed. The store must be created prior to calling this method. If duplicate tags are provided, then CouchDB will ignore them.

Jump to

Keyboard shortcuts

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