Retrieving a record
Retrieving an unencrypted record
GetRecord.Done done = new GetRecord.Done() {
void onGetRecordDone(@NonNull Record record, @NonNull CondensationObject object) {
// The object was found and parsed
}
void onGetRecordInvalid(@NonNull String reason) {
// The object was not found, or is not a record
}
void onGetRecordFailed(@NonNull String error) {
// The store reported an error
}
};
new GetRecord(hash, store, keyPair, done);
var done = keyPair.getRecord(hash, store);
done.onDone = function(record, object) {
// The object was found and parsed
};
done.onInvalid = function(reason !! String) {
// The object was not found, or is not a record
};
done.onFailed = function(error !! String) {
// The store reported an error
};
my ($record, $object, $invalidReason, $storeError) = $keyPair->getRecord($hash, $store);
if (defined $storeError) {
# The store reported an error
} elsif (defined $invalidReason) {
# The object was not found, or is not a record
} else {
# The object was found and parsed
}
Retrieves an object from a store, and parses it as a record.
If the store reports an error, the operation fails with that error. It may succeed when called again at a later time.
If the object is not found, or not a record, the operation fails as invalid.
Retrieving an encrypted record
GetRecord.Done done = new GetRecord.Done() {
void onGetRecordDone(@NonNull Record record, @NonNull CondensationObject object) {
// The object was found, decrypted, and parsed
}
void onGetRecordInvalid(@NonNull String reason) {
// The object was not found, or is not a record
}
void onGetRecordFailed(@NonNull String error) {
// The store reported an error
}
};
new GetAndDecryptRecord(reference, store, keyPair, done);
var done = keyPair.getAndDecryptRecord(reference, store);
done.onDone = function(record, object) {
// The object was found, decrypted, and parsed
};
done.onInvalid = function(reason !! String) {
// The object was not found, or is not a record
};
done.onFailed = function(error !! String) {
// The store reported an error
};
my ($record, $object, $invalidReason, $storeError) = $keyPair->getAndDecryptRecord($reference, $store);
if (defined $storeError) {
# The store reported an error
} elsif (defined $invalidReason) {
# The object was not found, or is not a record
} else {
# The object was found, decrypted, and parsed
}
As above, but decrypts the object before parsing the record.