MemoryCardStore (Common API)

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

MemoryCardStore

Transient in-memory storage of business network cards, useful for testing. To use this in preference to the default File System Card Store

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 MemoryCardStore()

Constructor.

See also

Parameters

No parameters

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