This module provides access to the Key-Value Store of CCF.

Example of using raw access:

import * as ccfapp from '@microsoft/ccf-app';

const foo = ccfapp.rawKv['foo'];
foo.set(
ccfapp.string.encode("key-1"),
ccfapp.json.encode({"prop1": 42})
);

Example of using typed access:

import * as ccfapp from '@microsoft/ccf-app';

const foo = ccfapp.typedKv('foo', ccfapp.string, ccfapp.json);
foo.set("key-1", {"prop1": 42});

Example of using typed access with historical state:

import * as ccfapp from '@microsoft/ccf-app';

const states = ccfapp.getStateRange(handle, begin, end, expiry);
// ... error handling ...
const firstKv = states[0].kv;
const foo = ccfapp.typedKv(firstKv['foo'], ccfapp.string, ccfapp.json);
const val = foo.get("key-1");

References

Classes

Variables

Functions

References

Re-exports KvMap
Re-exports KvMaps