pool

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Package pool is corresponding Go package for libindy's pool namespace. We suggest that you read indy SDK documentation for more information.

Pool offers functions to manage ledger pools. The Go wrapper has extended pool system which means that it supports ledger plugins to implement own persistent storage. These additional ledger can be used all at the same time:

select {
case r = <-pool.OpenLedger(poolName, "FINDY_MEM_LEDGER"):
	if r.Err() != nil {
		log.Panicln("Cannot open pool")
	}
case <-time.After(maxTimeout):
	log.Panicln("Timeout exceeded")
}
h := r.Handle()

Current implementation offers a memory ledger for tests and simple cache. The interface to use them is an extension to OpenLedger function which takes multiple ledger pool names at once.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseLedger

func CloseLedger(handle int) ctx.Channel

CloseLedger is exchanged indy SDK wrapper function. It closes all currently opened ledger plugins and the actual indy ledger if it is open as well.

func CreateConfig

func CreateConfig(name string, config Config) ctx.Channel

CreateConfig is indy SDK wrapper to create ledger pool configuration. See more information from indy_pool_create_config().

func IsIndyLedgerOpen

func IsIndyLedgerOpen(handle int) bool

IsIndyLedgerOpen return true if indy ledger is open as well. It is used to coordinate ledger transactions.

func List

func List() ctx.Channel

List is indy SDK wrapper to list current pool configurations on the host. See more information from indy_pool_list().

func ListPlugins

func ListPlugins() []string

ListPlugins is ledger plugin system function. With the function caller can have list of all currently installed and activated ledger plugins in the compilation.

func OpenLedger

func OpenLedger(names ...string) ctx.Channel

OpenLedger opens all ledger types given. The original indy SDK function takes only one pool configuration name as an argument. This wrapper takes many pool names where one can be an original indy pool and the rest can be any of the plugins compiled into the binary running. ListPlugins() returns all of the available ones.

func Read

func Read(ID string) (string, string, error)

Read reads data from all of the plugin ledgers. Note! The original indy ledger is not one of the plugin ledgers, at least not yet.

func RegisterPlugin

func RegisterPlugin(name string, plugin plugin.Ledger)

RegisterPlugin is interface for ledger plugins to register them selves.

func SetProtocolVersion

func SetProtocolVersion(version uint64) ctx.Channel

SetProtocolVersion is indy SDK wrapper. It sets the used protocol version. In most cases it is 2. See more information from indy_set_protocol_version().

func Write

func Write(ID, data string)

Write writes data to all of the plugin ledgers. Note! The original indy ledger is not one of the plugin ledgers, at least not yet.

Types

type Config

type Config struct {
	// GenesisTxn is full filename of the genesis file.
	GenesisTxn string `json:"genesis_txn,omitempty"`
}

Config is pool creating config structure used by indy.

Jump to

Keyboard shortcuts

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