pub struct Pool {}
Implementations
sourceimpl Pool
impl Pool
sourcepub fn create_ledger_config(
pool_name: &str,
pool_config: Option<&str>
) -> Result<(), ErrorCode>
pub fn create_ledger_config(
pool_name: &str,
pool_config: Option<&str>
) -> Result<(), ErrorCode>
Creates a new local pool ledger configuration that can be used later to connect pool nodes.
Arguments
config_name
- Name of the pool ledger configuration.config
(required)- Pool configuration json. Example: { “genesis_txn”: string (required), A path to genesis transaction file. }
sourcepub fn create_ledger_config_timeout(
pool_name: &str,
pool_config: Option<&str>,
timeout: Duration
) -> Result<(), ErrorCode>
pub fn create_ledger_config_timeout(
pool_name: &str,
pool_config: Option<&str>,
timeout: Duration
) -> Result<(), ErrorCode>
Creates a new local pool ledger configuration that can be used later to connect pool nodes.
Arguments
config_name
- Name of the pool ledger configuration.config
(required)- Pool configuration json. Example: { “genesis_txn”: string (required), A path to genesis transaction file. }timeout
- the maximum time this function waits for a response
sourcepub fn create_ledger_config_async<F: 'static>(
pool_name: &str,
pool_config: Option<&str>,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
pub fn create_ledger_config_async<F: 'static>(
pool_name: &str,
pool_config: Option<&str>,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
Creates a new local pool ledger configuration that can be used later to connect pool nodes.
Arguments
config_name
- Name of the pool ledger configuration.config
(required)- Pool configuration json. Example:closure
- the closure that is called when finished
Returns
errorcode
- errorcode from calling ffi function. The closure receives the return result
sourcepub fn open_ledger(
pool_name: &str,
config: Option<&str>
) -> Result<IndyHandle, ErrorCode>
pub fn open_ledger(
pool_name: &str,
config: Option<&str>
) -> Result<IndyHandle, ErrorCode>
Opens pool ledger and performs connecting to pool nodes.
Pool ledger configuration with corresponded name must be previously created with indy_create_pool_ledger_config method. It is impossible to open pool with the same name more than once.
Arguments
config_name
- Name of the pool ledger configuration.config
(optional)- Runtime pool configuration json. if NULL, then default config will be used. Example: { “refresh_on_open”: bool (optional), Forces pool ledger to be refreshed immediately after opening. Defaults to true. “auto_refresh_time”: int (optional), After this time in minutes pool ledger will be automatically refreshed. Use 0 to disable automatic refresh. Defaults to 24*60. “network_timeout”: int (optional), Network timeout for communication with nodes in milliseconds. Defaults to 20000. }
Returns
Handle to opened pool to use in methods that require pool connection.
sourcepub fn open_ledger_timeout(
pool_name: &str,
config: Option<&str>,
timeout: Duration
) -> Result<IndyHandle, ErrorCode>
pub fn open_ledger_timeout(
pool_name: &str,
config: Option<&str>,
timeout: Duration
) -> Result<IndyHandle, ErrorCode>
Opens pool ledger and performs connecting to pool nodes.
Pool ledger configuration with corresponded name must be previously created with indy_create_pool_ledger_config method. It is impossible to open pool with the same name more than once.
Arguments
config_name
- Name of the pool ledger configuration.config
(optional)- Runtime pool configuration json. if NULL, then default config will be used. Example: { “refresh_on_open”: bool (optional), Forces pool ledger to be refreshed immediately after opening. Defaults to true. “auto_refresh_time”: int (optional), After this time in minutes pool ledger will be automatically refreshed. Use 0 to disable automatic refresh. Defaults to 24*60. “network_timeout”: int (optional), Network timeout for communication with nodes in milliseconds. Defaults to 20000. }timeout
- the maximum time this function waits for a response
Returns
Handle to opened pool to use in methods that require pool connection.
sourcepub fn open_ledger_async<F: 'static>(
pool_name: &str,
config: Option<&str>,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode, IndyHandle) + Send,
pub fn open_ledger_async<F: 'static>(
pool_name: &str,
config: Option<&str>,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode, IndyHandle) + Send,
Opens pool ledger and performs connecting to pool nodes.
Pool ledger configuration with corresponded name must be previously created with indy_create_pool_ledger_config method. It is impossible to open pool with the same name more than once.
Arguments
config_name
- Name of the pool ledger configuration.config
(optional)- Runtime pool configuration json. if NULL, then default config will be used. Example: { “refresh_on_open”: bool (optional), Forces pool ledger to be refreshed immediately after opening. Defaults to true. “auto_refresh_time”: int (optional), After this time in minutes pool ledger will be automatically refreshed. Use 0 to disable automatic refresh. Defaults to 24*60. “network_timeout”: int (optional), Network timeout for communication with nodes in milliseconds. Defaults to 20000. }closure
- the closure that is called when finished
Returns
errorcode
- errorcode from calling ffi function. The closure receives the return result
sourcepub fn refresh(pool_handle: IndyHandle) -> Result<(), ErrorCode>
pub fn refresh(pool_handle: IndyHandle) -> Result<(), ErrorCode>
Refreshes a local copy of a pool ledger and updates pool nodes connections.
Arguments
handle
- pool handle returned by Pool::open_ledger
sourcepub fn refresh_timeout(
pool_handle: IndyHandle,
timeout: Duration
) -> Result<(), ErrorCode>
pub fn refresh_timeout(
pool_handle: IndyHandle,
timeout: Duration
) -> Result<(), ErrorCode>
Refreshes a local copy of a pool ledger and updates pool nodes connections.
Arguments
handle
- pool handle returned by Pool::open_ledgertimeout
- the maximum time this function waits for a response
sourcepub fn refresh_async<F: 'static>(
pool_handle: IndyHandle,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
pub fn refresh_async<F: 'static>(
pool_handle: IndyHandle,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
sourcepub fn list_timeout(timeout: Duration) -> Result<String, ErrorCode>
pub fn list_timeout(timeout: Duration) -> Result<String, ErrorCode>
Lists names of created pool ledgers
timeout
- the maximum time this function waits for a response
sourcepub fn list_async<F: 'static>(closure: F) -> ErrorCodewhere
F: FnMut(ErrorCode, String) + Send,
pub fn list_async<F: 'static>(closure: F) -> ErrorCodewhere
F: FnMut(ErrorCode, String) + Send,
Lists names of created pool ledgers
closure
- the closure that is called when finished
Returns
errorcode
- errorcode from calling ffi function. The closure receives the return result
sourcepub fn close(pool_handle: IndyHandle) -> Result<(), ErrorCode>
pub fn close(pool_handle: IndyHandle) -> Result<(), ErrorCode>
Closes opened pool ledger, opened nodes connections and frees allocated resources.
Arguments
handle
- pool handle returned by Pool::open_ledger.
sourcepub fn close_timeout(
pool_handle: IndyHandle,
timeout: Duration
) -> Result<(), ErrorCode>
pub fn close_timeout(
pool_handle: IndyHandle,
timeout: Duration
) -> Result<(), ErrorCode>
Closes opened pool ledger, opened nodes connections and frees allocated resources.
Arguments
handle
- pool handle returned by Pool::open_ledger.timeout
- the maximum time this function waits for a response
sourcepub fn close_async<F: 'static>(pool_handle: IndyHandle, closure: F) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
pub fn close_async<F: 'static>(pool_handle: IndyHandle, closure: F) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
sourcepub fn delete(pool_name: &str) -> Result<(), ErrorCode>
pub fn delete(pool_name: &str) -> Result<(), ErrorCode>
Deletes created pool ledger configuration.
Arguments
config_name
- Name of the pool ledger configuration to delete.
sourcepub fn delete_timeout(
pool_name: &str,
timeout: Duration
) -> Result<(), ErrorCode>
pub fn delete_timeout(
pool_name: &str,
timeout: Duration
) -> Result<(), ErrorCode>
Deletes created pool ledger configuration.
Arguments
config_name
- Name of the pool ledger configuration to delete.timeout
- the maximum time this function waits for a response
sourcepub fn delete_async<F: 'static>(pool_name: &str, closure: F) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
pub fn delete_async<F: 'static>(pool_name: &str, closure: F) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
sourcepub fn set_protocol_version(protocol_version: usize) -> Result<(), ErrorCode>
pub fn set_protocol_version(protocol_version: usize) -> Result<(), ErrorCode>
Set PROTOCOL_VERSION to specific version.
There is a global property PROTOCOL_VERSION that used in every request to the pool and specified version of Indy Node which Libindy works.
By default PROTOCOL_VERSION=1.
Arguments
protocol_version
- Protocol version will be used: 1 - for Indy Node 1.3 2 - for Indy Node 1.4
sourcepub fn set_protocol_version_timeout(
protocol_version: usize,
timeout: Duration
) -> Result<(), ErrorCode>
pub fn set_protocol_version_timeout(
protocol_version: usize,
timeout: Duration
) -> Result<(), ErrorCode>
Set PROTOCOL_VERSION to specific version.
There is a global property PROTOCOL_VERSION that used in every request to the pool and specified version of Indy Node which Libindy works.
By default PROTOCOL_VERSION=1.
Arguments
protocol_version
- Protocol version will be used: 1 - for Indy Node 1.3 2 - for Indy Node 1.4timeout
- the maximum time this function waits for a response
sourcepub fn set_protocol_version_async<F: 'static>(
protocol_version: usize,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
pub fn set_protocol_version_async<F: 'static>(
protocol_version: usize,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
Set PROTOCOL_VERSION to specific version.
There is a global property PROTOCOL_VERSION that used in every request to the pool and specified version of Indy Node which Libindy works.
By default PROTOCOL_VERSION=1.
Arguments
protocol_version
- Protocol version will be used: 1 - for Indy Node 1.3 2 - for Indy Node 1.4closure
- the closure that is called when finished
Returns
errorcode
- errorcode from calling ffi function. The closure receives the return result