MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / ordered_storage

Function ordered_storage

join/LSH/datasketch/storage.py:27–62  ·  view source on GitHub ↗

Return ordered storage system based on the specified config. The canonical example of such a storage container is ``defaultdict(list)``. Thus, the return value of this method contains keys and values. The values are ordered lists with the last added item at the end. Args:

(config, name=None)

Source from the content-addressed store, hash-verified

25
26
27def ordered_storage(config, name=None):
28 '''Return ordered storage system based on the specified config.
29
30 The canonical example of such a storage container is
31 ``defaultdict(list)``. Thus, the return value of this method contains
32 keys and values. The values are ordered lists with the last added
33 item at the end.
34
35 Args:
36 config (dict): Defines the configurations for the storage.
37 For in-memory storage, the config ``{'type': 'dict'}`` will
38 suffice. For Redis storage, the type should be ``'redis'`` and
39 the configurations for the Redis database should be supplied
40 under the key ``'redis'``. These parameters should be in a form
41 suitable for `redis.Redis`. The parameters may alternatively
42 contain references to environment variables, in which case
43 literal configuration values should be replaced by dicts of
44 the form::
45
46 {'env': 'REDIS_HOSTNAME',
47 'default': 'localhost'}
48
49 For a full example, see :ref:`minhash_lsh_at_scale`
50
51 name (bytes, optional): A reference name for this storage container.
52 For dict-type containers, this is ignored. For Redis containers,
53 this name is used to prefix keys pertaining to this storage
54 container within the database.
55 '''
56 tp = config['type']
57 if tp == 'dict':
58 return DictListStorage(config)
59 if tp == 'redis':
60 return RedisListStorage(config, name=name)
61 if tp == 'cassandra':
62 return CassandraListStorage(config, name=name)
63
64
65def unordered_storage(config, name=None):

Callers

nothing calls this directly

Calls 3

DictListStorageClass · 0.85
RedisListStorageClass · 0.85

Tested by

no test coverage detected