Skip to content

Commit 288b1da

Browse files
committed
backends lmdb convert v07 to v09 bugfix
1 parent 27a2899 commit 288b1da

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "hat-event"
3-
version = "0.9.24"
3+
version = "0.9.25"
44
description = "Hat event"
55
readme = "README.rst"
66
requires-python = ">=3.10"
@@ -10,7 +10,7 @@ dependencies = [
1010
"hat-aio ~=0.7.10",
1111
"hat-drivers ~=0.8.11",
1212
"hat-json ~=0.5.28",
13-
"hat-monitor ~=0.8.13",
13+
"hat-monitor ~=0.8.15",
1414
"hat-sbs ~=0.7.2",
1515
"hat-util ~=0.6.16",
1616
"lmdb >=1.4.1, <1.6",

requirements.pip.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ hat-aio ~=0.7.10
33
hat-doit ~=0.15.16
44
hat-drivers ~=0.8.11
55
hat-json ~=0.5.28
6-
hat-monitor ~=0.8.13
6+
hat-monitor ~=0.8.15
77
hat-sbs ~=0.7.2
88
hat-util ~=0.6.16
99
lmdb >=1.4.1, <1.6

src_py/hat/event/backends/lmdb/convert/convert_v07_to_v09.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def _convert_system_db(src_txn, src_dbs, dst_env, dst_dbs):
2424
v09.write(dst_env, dst_dbs, v09.DbType.SYSTEM_SETTINGS,
2525
v09.SettingsId.VERSION, v09.version)
2626

27-
with src_txn.cursor(db=src_dbs[v07.SYSTEM]) as src_cursor:
27+
with src_txn.cursor(db=src_dbs[v07.DbType.SYSTEM]) as src_cursor:
2828
for src_key, src_value in src_cursor:
2929
server_id = v07.decode_system_db_key(src_key)
3030
src_event_id, src_timestamp = v07.decode_system_db_value(src_value)
@@ -40,7 +40,7 @@ def _convert_system_db(src_txn, src_dbs, dst_env, dst_dbs):
4040

4141

4242
def _convert_ref_db(src_txn, src_dbs, dst_env, dst_dbs):
43-
with src_txn.cursor(db=src_dbs[v07.REF]) as src_cursor:
43+
with src_txn.cursor(db=src_dbs[v07.DbType.REF]) as src_cursor:
4444
for src_key, src_value in src_cursor:
4545
src_event_id = v07.decode_ref_db_key(src_key)
4646
src_event_refs = v07.decode_ref_db_value(src_value)
@@ -54,7 +54,7 @@ def _convert_ref_db(src_txn, src_dbs, dst_env, dst_dbs):
5454

5555

5656
def _convert_latest_db(src_txn, src_dbs, dst_env, dst_dbs):
57-
with src_txn.cursor(db=src_dbs[v07.LATEST_DATA]) as src_cursor:
57+
with src_txn.cursor(db=src_dbs[v07.DbType.LATEST_DATA]) as src_cursor:
5858
for src_key, src_value in src_cursor:
5959
event_type_ref = v07.decode_latest_data_db_key(src_key)
6060
src_event = v07.decode_latest_data_db_value(src_value)
@@ -64,7 +64,7 @@ def _convert_latest_db(src_txn, src_dbs, dst_env, dst_dbs):
6464
v09.write(dst_env, dst_dbs, v09.DbType.LATEST_DATA,
6565
event_type_ref, dst_event)
6666

67-
with src_txn.cursor(db=src_dbs[v07.LATEST_TYPE]) as src_cursor:
67+
with src_txn.cursor(db=src_dbs[v07.DbType.LATEST_TYPE]) as src_cursor:
6868
for src_key, src_value in src_cursor:
6969
event_type_ref = v07.decode_latest_type_db_key(src_key)
7070
event_type = v07.decode_latest_type_db_value(src_value)
@@ -74,7 +74,7 @@ def _convert_latest_db(src_txn, src_dbs, dst_env, dst_dbs):
7474

7575

7676
def _convert_timeseries_db(src_txn, src_dbs, dst_env, dst_dbs):
77-
with src_txn.cursor(db=src_dbs[v07.ORDERED_DATA]) as src_cursor:
77+
with src_txn.cursor(db=src_dbs[v07.DbType.ORDERED_DATA]) as src_cursor:
7878
for src_key, src_value in src_cursor:
7979
partition_id, src_timestamp, src_event_id = \
8080
v07.decode_ordered_data_db_key(src_key)
@@ -87,7 +87,7 @@ def _convert_timeseries_db(src_txn, src_dbs, dst_env, dst_dbs):
8787
v09.write(dst_env, dst_dbs, v09.DbType.TIMESERIES_DATA,
8888
(partition_id, dst_timestamp, dst_event_id), dst_event)
8989

90-
with src_txn.cursor(db=src_dbs[v07.ORDERED_PARTITION]) as src_cursor:
90+
with src_txn.cursor(db=src_dbs[v07.DbType.ORDERED_PARTITION]) as src_cursor: # NOQA
9191
for src_key, src_value in src_cursor:
9292
partition_id = v07.decode_ordered_partition_db_key(src_key)
9393
src_partition_data = v07.decode_ordered_partition_db_value(
@@ -98,7 +98,7 @@ def _convert_timeseries_db(src_txn, src_dbs, dst_env, dst_dbs):
9898
v09.write(dst_env, dst_dbs, v09.DbType.TIMESERIES_PARTITION,
9999
partition_id, dst_partition_data)
100100

101-
with src_txn.cursor(db=src_dbs[v07.ORDERED_COUNT]) as src_cursor:
101+
with src_txn.cursor(db=src_dbs[v07.DbType.ORDERED_COUNT]) as src_cursor:
102102
for src_key, src_value in src_cursor:
103103
partition_id = v07.decode_ordered_count_db_key(src_key)
104104
count = v07.decode_ordered_count_db_value(src_value)
@@ -126,7 +126,7 @@ def _convert_event_ref(src_event_ref):
126126
dst_event_id = _convert_event_id(src_event_id)
127127

128128
dst_key = partition_id, dst_timestamp, dst_event_id
129-
return v09.LatestEventRef(dst_key)
129+
return v09.TimeseriesEventRef(dst_key)
130130

131131
raise ValueError('unsupported event reference')
132132

@@ -150,7 +150,7 @@ def _convert_payload(src_payload):
150150
data=src_payload.data)
151151

152152
if src_payload.type == v07.EventPayloadType.JSON:
153-
pass
153+
return v09.EventPayloadJson(data=src_payload.data)
154154

155155
if src_payload.type == v07.EventPayloadType.SBS:
156156
binary_type = (f'{src_payload.data.module}.{src_payload.data.type}'

0 commit comments

Comments
 (0)