get method

  1. @override
Future get(
  1. PeerId p,
  2. String key
)
override

Get / Put is a simple registry for other peer-related key/value pairs. If we find something we use often, it should become its own set of methods. This is a last resort.

Implementation

@override
Future<dynamic> get(PeerId p, String key) async {
  // Using synchronous lock to match interface
  return await _lock.synchronized(() async {
    final m = _ds[p.toString()];
    if (m == null) {
      throw const ErrNotFound();
    }
    final val = m[key];
    if (val == null) {
      throw const ErrNotFound();
    }
    return val;
  });
}