getAllReplicas method

Future<List<GetReplicaResult>> getAllReplicas(
  1. String key, [
  2. GetAllReplicasOptions? options
])

Retrieves the value of the document from all available replicas.

Note that as replication is asynchronous, each node may return a different value.

Implementation

Future<List<GetReplicaResult>> getAllReplicas(
  String key, [
  GetAllReplicasOptions? options,
]) async {
  options ??= const GetAllReplicasOptions();

  final response = await _connection.getAllReplicas(
    GetAllReplicasRequest(
      id: _documentId(key),
      timeout: _kvTimeout(options),
    ),
  );

  return [
    for (final entry in response.entries)
      GetReplicaResult(
        content: _decodeDocument(options, entry.flags, entry.value),
        cas: entry.cas,
        isReplica: entry.replica,
      ),
  ];
}