Account with Key
An account with its public key. The account hash is implicitly given by the hash of the public key.
Instance creation
AccountWithKey accountWithKey = new AccountWithKey(store, publicKey);
var accountWithKey = new cds.AccountWithKey(store, publicKey);
my $accountWithKey = CDS::AccountWithKey->new($store, $publicKey);
Creates an instance.
PublicKeyCache.Done done = new PublicKeyCache.Done() {
void onGetPublicKeyDone(PublicKey publicKey) {
AccountWithKey accountWithKey = new AccountWithKey(store, publicKey);
...
}
void onGetPublicKeyNotFound() { ... }
void onGetPublicKeyFailed(String error) { ... }
};
PublicKeyCache.get(hash, done);
var done = cds.publicKeyCache.get(hash);
done.onDone = function(publicKey) {
var accountWithKey = new cds.AccountWithKey(store, publicKey);
...
};
done.onNotFound = function() { ... }
done.onFailed = function(error) { ... }
my ($publicKey, $error) = CDS::PublicKeyCache->get($hash);
if (defined $error) {
# Store error
...
} elsif (! defined $publicKey)
# Not found
...
}
# Found
my $accountWithKey = CDS::AccountWithKey->new($store, $publicKey);
...
Retrieves a public key, and creates an instance.
Threading
Instances of this class are immutable and can be accessed concurrently from multiple threads.