MCPcopy Create free account
hub / github.com/cosdata/cosdata / main

Function main

tests/test-key-value-store-simple.py:145–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143 return bytes(response.json()["bytes"]).decode("utf-8")
144
145def main():
146 # Initialize client session
147 create_session()
148
149 name = "key_value_store_test"
150
151 # Create collection and index
152 create_db(name)
153 create_index(name)
154
155 # Create transaction and index vectors
156 print("Creating transaction and indexing vectors...")
157
158 txn_id = create_transaction(name)
159
160 try:
161 upsert(name, txn_id, "a", "Hello")
162 upsert(name, txn_id, "b", "World")
163 commit_transaction(name, txn_id)
164 except Exception:
165 abort_transaction(name, txn_id)
166
167
168 a = lookup(name, "a")
169 b = lookup(name, "b")
170
171 print(f"Expected: \"Hello\", Found: \"{a}\"")
172 print(f"Expected: \"World\", Found: \"{b}\"")
173
174
175if __name__ == "__main__":

Callers 1

Calls 8

create_sessionFunction · 0.70
create_dbFunction · 0.70
create_indexFunction · 0.70
create_transactionFunction · 0.70
upsertFunction · 0.70
commit_transactionFunction · 0.70
abort_transactionFunction · 0.70
lookupFunction · 0.70

Tested by

no test coverage detected