TransactionalMultiMap

class TransactionalMultiMap(name, transaction, context)[source]

Bases: TransactionalProxy, Generic[KeyType, ValueType]

Transactional implementation of MultiMap.

put(key: KeyType, value: ValueType) bool[source]

Transactional implementation of MultiMap.put(key, value)

Parameters
  • key – The key to be stored.

  • value – The value to be stored.

Returns

True if the size of the multimap is increased, False if the multimap already contains the key-value tuple.

get(key: KeyType) Optional[List[ValueType]][source]

Transactional implementation of MultiMap.get(key)

Parameters

key – The key whose associated values are returned.

Returns

The collection of the values associated with the key.

remove(key: KeyType, value: ValueType) bool[source]

Transactional implementation of MultiMap.remove(key, value)

Parameters
  • key – The key of the entry to remove.

  • value – The value of the entry to remove.

Returns

True if the item is removed, False otherwise.

remove_all(key: KeyType) List[ValueType][source]

Transactional implementation of MultiMap.remove_all(key)

Parameters

key – The key of the entries to remove.

Returns

The collection of the values associated with the key.

value_count(key: KeyType) int[source]

Transactional implementation of MultiMap.value_count(key)

Parameters

key – The key whose number of values is to be returned.

Returns

The number of values matching the given key in the multimap.

size() int[source]

Transactional implementation of MultiMap.size()

Returns

The number of key-value tuples in the multimap.