Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jafermarq committed Feb 24, 2025
1 parent 72aab3f commit 329e30f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from typing import Optional
from uuid import UUID, uuid4

from flwr.common import Context, log, now
from flwr.common import Context, Metadata, log, now
from flwr.common.constant import (
MESSAGE_TTL_TOLERANCE,
NODE_ID_NUM_BYTES,
Expand Down Expand Up @@ -72,6 +72,7 @@ def __init__(self) -> None:
self.task_ins_store: dict[UUID, TaskIns] = {}
self.task_res_store: dict[UUID, TaskRes] = {}
self.task_ins_id_to_task_res_id: dict[UUID, UUID] = {}
self.in_processing_messages: dict[UUID, Metadata] = {}

self.node_public_keys: set[bytes] = set()

Expand Down
2 changes: 1 addition & 1 deletion src/py/flwr/server/superlink/linkstate/linkstate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ def test_initialize(self) -> None:
result = state.query("SELECT name FROM sqlite_schema;")

# Assert
assert len(result) == 15
assert len(result) == 17


class SqliteFileBasedTest(StateTest, unittest.TestCase):
Expand Down
15 changes: 15 additions & 0 deletions src/py/flwr/server/superlink/linkstate/sqlite_linkstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@
);
"""

SQL_CREATE_TABLE_IN_PROCESSING_MESSAGES = """
CREATE TABLE IF NOT EXISTS in_processing_messages(
message_id TEXT UNIQUE,
run_id INTEGER,
src_node_id INTEGER,
dst_node_id INTEGER,
reply_to_message TEXT,
group_id TEXT,
ttl REAL,
message_type TEXT,
FOREIGN KEY(run_id) REFERENCES run(run_id)
);
"""

DictOrTuple = Union[tuple[Any, ...], dict[str, Any]]


Expand Down Expand Up @@ -198,6 +212,7 @@ def initialize(self, log_queries: bool = False) -> list[tuple[str]]:
cur.execute(SQL_CREATE_TABLE_CONTEXT)
cur.execute(SQL_CREATE_TABLE_TASK_INS)
cur.execute(SQL_CREATE_TABLE_TASK_RES)
cur.execute(SQL_CREATE_TABLE_IN_PROCESSING_MESSAGES)
cur.execute(SQL_CREATE_TABLE_NODE)
cur.execute(SQL_CREATE_TABLE_PUBLIC_KEY)
cur.execute(SQL_CREATE_INDEX_ONLINE_UNTIL)
Expand Down

0 comments on commit 329e30f

Please sign in to comment.