From 9b47bdbc5a89d16e9de855b501c9818271f42f50 Mon Sep 17 00:00:00 2001 From: Derek Trider Date: Tue, 5 Apr 2022 21:48:58 -0400 Subject: [PATCH] docs: Storage compatibility matrix Added a document that lists what storage providers we have implemented and what functionality is implemented. Also made some small additions to the storage interface documentation. Signed-off-by: Derek Trider --- docs/storage_compatibility_matrix.md | 69 ++++++++++++++++++++++++++++ spi/storage/storage.go | 2 + 2 files changed, 71 insertions(+) create mode 100644 docs/storage_compatibility_matrix.md diff --git a/docs/storage_compatibility_matrix.md b/docs/storage_compatibility_matrix.md new file mode 100644 index 0000000000..38913c3f68 --- /dev/null +++ b/docs/storage_compatibility_matrix.md @@ -0,0 +1,69 @@ +# Storage Compatibility Matrix + +Aries-Framework-Go (this repo) and [Aries-Framework-Go-Ext](https://github.com/hyperledger/aries-framework-go-ext) have a number of storage providers that implement the [Aries storage interfaces](../spi/storage/storage.go). + +This document lists the storage provider implementations we have and what functionality is currently implemented/supported. + +The functions defined in the interfaces can be categorized as either "core" or "extended" functionality. + +✓ = Implemented + +X = Not implemented (but could be) + +Unsupported = Not implemented (and not currently supported by the underlying database/technology/spec) + +## Core Functionality + +These are the functions that the Aries agent currently uses. For a storage provider implementation to work in an Aries agent, it needs to support **all** the functions below. + +| | [MongoDB](https://github.com/hyperledger/aries-framework-go-ext/blob/main/component/storage/mongodb) | [CouchDB](https://github.com/hyperledger/aries-framework-go-ext/blob/main/component/storage/couchdb) | [EDV](https://github.com/hyperledger/aries-framework-go/tree/main/component/storage/edv) | [MySQL](https://github.com/hyperledger/aries-framework-go-ext/tree/main/component/storage/mysql) | [IndexedDB](https://github.com/hyperledger/aries-framework-go/tree/main/component/storage/indexeddb) | [LevelDB](https://github.com/hyperledger/aries-framework-go/tree/main/component/storage/leveldb) | [In-Memory](https://github.com/hyperledger/aries-framework-go/tree/main/component/storageutil/mem) | [PostgreSQL](https://github.com/hyperledger/aries-framework-go-ext/tree/main/component/storage/postgresql) | +|---------------------------|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------| +| Provider - OpenStore | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Provider - SetStoreConfig | ✓ | ✓ | ✓* | ✓** | ✓*** | ✓ | ✓ | ✓**** | +| Provider - Close | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Store - Put | ✓ | ✓ | ✓ | ✓** | ✓*** | ✓ | ✓ | ✓**** | +| Store - Get | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Store - Query Using 1 Tag | ✓ | ✓ | ✓ | ✓** | ✓*** | ✓ | ✓ | X***** | +| Store - Delete | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Store - Close | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Iterator - Next | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Iterator - Key | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Iterator - Value | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Iterator - Close | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | + +\* This method is more or less a no-op since EDV doesn't need this. Store config is just stored in-memory for now - see [here](https://github.com/hyperledger/aries-framework-go-ext/issues/2492) for more info. Since the Aries agent doesn't currently use GetStoreConfig, this isn't an issue for Aries usages. + +\*\* Current tagging/querying mechanism is unoptimized and not recommended for production use as-is. See [here](https://github.com/hyperledger/aries-framework-go-ext/issues/67) for more info. + +\*\*\* Current tagging/querying mechanism is unoptimized and not recommended for production use as-is. See [here](https://github.com/hyperledger/aries-framework-go-ext/issues/2540) for more info. + +\*\*\*\* There are some limitations with the current implementation of these methods. See [here](https://github.com/hyperledger/aries-framework-go-ext/issues/229) for more info. + +\*\*\*\*\* Tag name only queries have been implemented, but not tag name + value queries. Both types of queries are used by an Aries agent. See [here](https://github.com/hyperledger/aries-framework-go-ext/issues/229) for more info. + +## Extended Functionality + +The Aries agent does not currently make use of these functions, but they may be useful in building your own application. + +| | [MongoDB](https://github.com/hyperledger/aries-framework-go-ext/blob/main/component/storage/mongodb) | [CouchDB](https://github.com/hyperledger/aries-framework-go-ext/blob/main/component/storage/couchdb) | [EDV](https://github.com/hyperledger/aries-framework-go/tree/main/component/storage/edv) | [MySQL](https://github.com/hyperledger/aries-framework-go-ext/tree/main/component/storage/mysql) | [IndexedDB](https://github.com/hyperledger/aries-framework-go/tree/main/component/storage/indexeddb) | [LevelDB](https://github.com/hyperledger/aries-framework-go/tree/main/component/storage/leveldb) | [In-Memory](https://github.com/hyperledger/aries-framework-go/tree/main/component/storageutil/mem) | [PostgreSQL](https://github.com/hyperledger/aries-framework-go-ext/tree/main/component/storage/postgresql) | +|-------------------------------------------------|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------| +| Provider - GetStoreConfig | ✓ | ✓ | ✓* | ✓** | ✓*** | ✓*** | ✓ | X | +| Provider - GetOpenStores | ✓ | ✓ | ✓ | X | X | ✓ | ✓ | X | +| Store - GetTags | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | X | +| Store - GetBulk | ✓ | ✓ | ✓ | X | X | ✓**** | ✓ | X | +| Store - Query Using Range Operators (<,<=,>,=>) | ✓ | X | Unsupported | X | X | X | X | X | +| Store - Query Using Multiple Tags | ✓ | X | X | X | X | X | X | X | +| Store - Query Using Custom Pagination | ✓ | ✓ | Unsupported | X | X | X | X | X | +| Store - Query Using Custom Sorting | ✓ | ✓ | Unsupported | X | X | X | X | X | +| Store - Batch | ✓ | ✓ | ✓ | ✓ | ✓ | ✓**** | ✓ | X | +| Store - Flush | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Iterator - Tags | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | X | +| Iterator - TotalItems | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | X | + +\* Only returns store config if it's still in memory. Can't be used to report whether the underlying database exists. + +\*\* Doesn't currently check the underlying data for existence (looks at in-memory stores instead). See [here](https://github.com/hyperledger/aries-framework-go-ext/issues/167) for more info. + +\*\*\* Doesn't currently check the underlying data for existence (looks at in-memory stores instead). See [here](https://github.com/hyperledger/aries-framework-go/issues/2948) for more info. + +\*\*\*\* Unoptimized implementation. See [here](https://github.com/hyperledger/aries-framework-go/issues/2605) for more info. \ No newline at end of file diff --git a/spi/storage/storage.go b/spi/storage/storage.go index 4e112d8b1b..ec38d73519 100644 --- a/spi/storage/storage.go +++ b/spi/storage/storage.go @@ -194,6 +194,7 @@ type Store interface { // GetTags fetches all tags associated with the given key. // If key cannot be found, then an error wrapping ErrDataNotFound will be returned. // If key is empty, then an error will be returned. + // As of writing, aries-framework-go code does not use this, but it may be useful for custom solutions. GetTags(key string) ([]Tag, error) // GetBulk fetches the values associated with the given keys. @@ -225,6 +226,7 @@ type Store interface { // enabled and a key is used that already exists in the database. // Depending on the implementation, this method may be faster than repeated Put and/or Delete calls. // If any of the given keys are empty, or the operations slice is empty or nil, then an error will be returned. + // As of writing, aries-framework-go code does not use this, but it may be useful for custom solutions. Batch(operations []Operation) error // Flush forces any queued up Put and/or Delete operations to execute.