Documentation
¶
Overview ¶
Package dao provides abstraction of persistence layer used by pydio services.
Index ¶
- func IsShared(driverName string) (bool, error)
- func RegisterDAODriver(name string, daoF DaoProviderFunc, connF ConnProviderFunc)
- func RegisterIndexerDriver(name string, daoF IndexerWrapperFunc)
- func RegisterSharedDAODriver(name string, daoF DaoProviderFunc, connF ConnProviderFunc)
- func UnknownDriverType(name string) error
- func UnsupportedDriver(o DAO) error
- func UnsupportedDriverType(name string) error
- type Conn
- type ConnDriver
- type ConnProviderFunc
- type DAO
- type DaoProviderFunc
- type DaoWrapperFunc
- type DriverProviderFunc
- type FacetParser
- type IndexCodex
- type IndexDAO
- type IndexIDProvider
- type IndexerWrapperFunc
- type MigratorFunc
- type MigratorStatus
- type QueryOptionsProvider
- type QueryPreCountRequester
- type UnknownDriverTypeErr
- type UnsupportedDriverTypeErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsShared ¶ added in v4.0.1
IsShared indicates if a DAO is shared across services or a locked to a local file
func RegisterDAODriver ¶
func RegisterDAODriver(name string, daoF DaoProviderFunc, connF ConnProviderFunc)
RegisterDAODriver registers factories for DAOs and Connections that are storing data on-file (cannot be shared across multiple nodes)
func RegisterIndexerDriver ¶
func RegisterIndexerDriver(name string, daoF IndexerWrapperFunc)
RegisterIndexerDriver registers factories for Indexers
func RegisterSharedDAODriver ¶ added in v4.0.1
func RegisterSharedDAODriver(name string, daoF DaoProviderFunc, connF ConnProviderFunc)
RegisterSharedDAODriver registers factories for DAOs and Connections that can be shared across multiple nodes
func UnknownDriverType ¶ added in v4.0.1
func UnsupportedDriver ¶ added in v4.0.1
func UnsupportedDriverType ¶ added in v4.0.1
Types ¶
type ConnDriver ¶
type ConnProviderFunc ¶
type ConnProviderFunc func(ctx context.Context, driver, dsn string) ConnDriver
type DAO ¶
type DAO interface {
registry.Dao
Init(context.Context, configx.Values) error
GetConn(context.Context) (Conn, error)
SetConn(context.Context, Conn)
CloseConn(context.Context) error
// Prefix is used to prevent collision between table names
// in case this DAO accesses a shared DB.
Prefix() string
// LocalAccess returns true if DAO relies on an on-file DB
LocalAccess() bool
// Stats may return info about the underlying driver/conn
Stats() map[string]interface{}
}
DAO interface definition
func AbstractDAO ¶
AbstractDAO returns a reference to a newly created struct that contains the necessary information to access a database. Prefix parameter is used to specify a prefix to avoid collision between table names in case this DAO accesses a shared DB: it thus will be an empty string in most of the cases.
func InitDAO ¶
func InitDAO(ctx context.Context, driver, dsn, prefix string, wrapper DaoWrapperFunc, cfg ...configx.Values) (DAO, error)
InitDAO finalize DAO creation based on registered drivers
func InitIndexer ¶
func InitIndexer(ctx context.Context, driver, dsn, prefix string, wrapper DaoWrapperFunc, cfg ...configx.Values) (DAO, error)
InitIndexer looks up in the register to initialize a DAO and wrap it as an IndexDAO
type DaoProviderFunc ¶
type DriverProviderFunc ¶
type FacetParser ¶
type FacetParser interface {
UnmarshalFacet(data interface{}, facets chan interface{})
FlushCustomFacets() []interface{}
}
FacetParser adds additional capacities to IndexCodex for understanding search results Facets
type IndexCodex ¶
type IndexCodex interface {
// Marshal prepares a document for storing in index
Marshal(input interface{}) (interface{}, error)
// Unmarshal decodes a document found in index
Unmarshal(indexed interface{}) (interface{}, error)
// BuildQuery prepares a query to be executed. It returns a request object and optionally an aggregationRequest object
BuildQuery(query interface{}, offset, limit int32, sortFields string, sortDesc bool) (interface{}, interface{}, error)
// GetModel reads initialization schema to be loaded
GetModel(sc configx.Values) (interface{}, bool)
}
IndexCodex is the coder/decoder used by an Indexer.
type IndexDAO ¶
type IndexDAO interface {
DAO
// SetCodex sets the IndexCodex to be used for marshalling/unmarshalling data. Can be locally overriden during FindMany requests.
SetCodex(c IndexCodex)
// InsertOne stores one document. Write operations may be batched underneath.
InsertOne(ctx context.Context, data interface{}) error
// DeleteOne deletes one document. It can only be used if documents are providing IDs.
DeleteOne(ctx context.Context, data interface{}) error
// Flush triggers internal buffers to be written to storage
Flush(ctx context.Context) error
// DeleteMany deletes documents by a search query.
DeleteMany(ctx context.Context, query interface{}) (int32, error)
// FindMany sends a search query to indexer. A custom IndexCodex can be used to accumulate some information during results parsing.
FindMany(ctx context.Context, query interface{}, offset, limit int32, sortFields string, sortDesc bool, customCodec IndexCodex) (chan interface{}, error)
// Resync should clear the index and rewrite it from scratch. Used by bolt implementations for defragmentation.
Resync(ctx context.Context, logger func(string)) error
// Truncate should free some disk space. Used by bleve implementation in conjunction with rotationSize parameter.
Truncate(ctx context.Context, max int64, logger func(string)) error
// Close closes the index connection
Close(ctx context.Context) error
}
IndexDAO is a rich DAO with ready-to-use inserts + search capacities. It must be initialised with a proper DAO and a proper IndexCodex.
type IndexIDProvider ¶
type IndexIDProvider interface {
IndexID() string
}
IndexIDProvider can be implemented by marshaled data to be indexed for providing an index ID.
type MigratorFunc ¶
type MigratorStatus ¶ added in v4.0.1
type QueryOptionsProvider ¶
type QueryOptionsProvider interface {
BuildQueryOptions(query interface{}, offset, limit int32, sortFields string, sortDesc bool) (interface{}, error)
}
QueryOptionsProvider adds additional capacities to IndexCodex for building search Query
type QueryPreCountRequester ¶ added in v4.4.12
type QueryPreCountRequester interface {
RequirePreCount() bool
}
QueryPreCountRequester adds an additional facet to send a Count request before sending the actual request
type UnknownDriverTypeErr ¶ added in v4.0.1
type UnknownDriverTypeErr struct {
Driver string
}
func (*UnknownDriverTypeErr) Error ¶ added in v4.0.1
func (u *UnknownDriverTypeErr) Error() string
type UnsupportedDriverTypeErr ¶ added in v4.0.1
type UnsupportedDriverTypeErr struct {
Driver string
}
func (*UnsupportedDriverTypeErr) Error ¶ added in v4.0.1
func (u *UnsupportedDriverTypeErr) Error() string
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bleve provides tools for using Bolt as a standard persistence layer for services.
|
Package bleve provides tools for using Bolt as a standard persistence layer for services. |
|
Package boltdb provides tools for using Bolt as a standard persistence layer for services
|
Package boltdb provides tools for using Bolt as a standard persistence layer for services |