storage

package
v0.0.0-...-1ee748b Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package storage includes sample implementations of different store mechanisms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotFoundError

func NotFoundError(req *protov1.QueryRequest) error

NotFoundError is a utility function returning an error instance that indicates a resolve request target's doesn't exist.

Types

type Ephemeral

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

Ephemeral provides an in-memory store for development and testing.

func (*Ephemeral) Close

func (e *Ephemeral) Close() error

Close will release used-memory.

func (*Ephemeral) Delete

func (e *Ephemeral) Delete(id *did.Identifier) error

Delete any existing record for the provided DID instance.

func (*Ephemeral) Description

func (e *Ephemeral) Description() string

Description returns a brief summary for the storage instance.

func (*Ephemeral) Exists

func (e *Ephemeral) Exists(id *did.Identifier) bool

Exists returns true if the provided DID instance is already available in the store.

func (*Ephemeral) Get

Get a previously stored DID instance.

func (*Ephemeral) Open

func (e *Ephemeral) Open(_ string) error

Open is a no-op for the ephemeral store. As an example just setup internally used structures.

func (*Ephemeral) Save

func (e *Ephemeral) Save(id *did.Identifier, proof *did.ProofLD) error

Save will create or update an entry for the provided DID instance.

type MongoStore

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

MongoStore provides a storage handler utilizing MongoDB as underlying database.

func (*MongoStore) Close

func (ms *MongoStore) Close() error

Close the client connection with the backend server.

func (*MongoStore) Delete

func (ms *MongoStore) Delete(id *did.Identifier) error

Delete any existing record for the provided DID instance.

func (*MongoStore) Description

func (ms *MongoStore) Description() string

Description returns a brief summary for the storage instance.

func (*MongoStore) Exists

func (ms *MongoStore) Exists(id *did.Identifier) bool

Exists returns true if the provided DID instance is already available in the store.

func (*MongoStore) Get

Get a previously stored DID instance.

func (*MongoStore) Open

func (ms *MongoStore) Open(info string) error

Open establish the connection and database selection for the instance. Must be called before any further operations. `info` MUST be a valid MongoDB connection string, optionally followed by a database identifier; for example: `mongodb://localhost:27017|my_db`. https://www.mongodb.com/docs/manual/reference/connection-string/

func (*MongoStore) Save

func (ms *MongoStore) Save(id *did.Identifier, proof *did.ProofLD) error

Save will create or update an entry for the provided DID instance.

type NotFound

type NotFound struct {
	// DID subject.
	Subject string

	// DID method.
	Method string
}

NotFound is returned when a resolve operation targets a non-existing DID.

func (*NotFound) Error

func (nf *NotFound) Error() string

Error returns a string representation of the `not found` instance.

func (*NotFound) Is

func (nf *NotFound) Is(target error) bool

Is provides the custom comparison logic for the error type.

Jump to

Keyboard shortcuts

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