FileSystemCardStore (Common API)

Overview - Common API - Client API - Admin API - Runtime API

FileSystemCardStore

Manages persistence of business network cards to a Node file system implementation. This is the default cardstore of Admin and Business Network connections. It stores card in the ~/.composer directory.

Details

  • Extends BusinessNetworkCardStore

  • Module common

See also

Method Summary

Name Returns Description
constructor void Constructor
delete void Delete a specific card from the store.
get void Gets a card from the store.
getAll void Gets all cards from the store.
has void Has returns a boolean indicating whether a card with the specified name exists or not.
put void Puts a card in the store. If the named card already exists in the store, it will be replaced.

Inherited Method Summary

Supertype Name Returns Description
BusinessNetworkCardStore getDefaultCardName String Get a default name for a given business network card

Method Details

new FileSystemCardStore()

Constructor.

See also

Parameters

Name Type Mandatory Description
options Object Yes Additional configuration options for the card store.

Sub-options

Name Type Mandatory Description
options.fs Yes Node file system implementation. Defaults to Node implementation.
options.storePath String Yes Location of the card store. Default: $HOME/.composer/cards

get

Promise get( String cardname )

Gets a card from the store.

Returns

Promise - A promise that is resolved with an IdCard, or rejected if the card does not exist.

See also

Parameters

Name Type Mandatory Description
cardName String Yes The name of the card to get

put

Promise put( String cardname, IdCard card )

Puts a card in the store. If the named card already exists in the store, it will be replaced.

Returns

Promise - A promise that resolves once the data is written

See also

Parameters

Name Type Mandatory Description
cardName String Yes The name of the card to save
card IdCard Yes The card

has

Promise has( String cardname )

Has returns a boolean indicating whether a card with the specified name exists or not.

Returns

Promise - A promise resolved with true or false.

See also

Parameters

Name Type Mandatory Description
cardName String Yes The name of the card to check

getAll

Promise getAll( )

Gets all cards from the store.

Returns

Promise - A promise that is resolved with a Map where the keys are identity card names and the values are IdCard objects.

See also

Parameters

No parameters

delete

Promise delete( String cardname )

Delete a specific card from the store.

Returns

Promise - A promise that resolves to true if the card existed; otherwise false.

See also

Parameters

Name Type Mandatory Description
cardName String Yes The name of the card to delete.

Inherited methods

getDefaultCardName

String getDefaultCardName( IdCard card )

Inherited from: BusinessNetworkCardStore

Get a default name for a given business network card.

Returns

String - A card name

See also

Parameters

Name Type Mandatory Description
card IdCard Yes A business network card