-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implemented sqlite persistence for store and forward (SAF). - Nodes keep track of a timestamp that they last requested messages for - Nodes use that timestamp when requesting messages to reduce the number of duplicate messages requested - Request for SAF messages is broken up into 3 responses: Discovery, Join and ExplicitlyAddressed - respectively, discovery messages, join messages and messages that are explicitly addressed to this node. - DB migrations run on node startup - Sqlite operations run on tokio blocking threads - Sqlite connection interface that allows usage of sqlite's in-memory database connection in addition to the file-system database
- Loading branch information
Showing
42 changed files
with
1,869 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# For documentation on how to configure this file, | ||
# see diesel.rs/guides/configuring-diesel-cli | ||
|
||
[print_schema] | ||
file = "src/schema.rs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP TABLE IF EXISTS stored_messages; | ||
DROP TABLE IF EXISTS dht_settings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
CREATE TABLE stored_messages ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
version INT NOT NULL, | ||
origin_pubkey TEXT NOT NULL, | ||
origin_signature TEXT NOT NULL, | ||
message_type INT NOT NULL, | ||
destination_pubkey TEXT, | ||
destination_node_id TEXT, | ||
header BLOB NOT NULL, | ||
body BLOB NOT NULL, | ||
is_encrypted BOOLEAN NOT NULL CHECK (is_encrypted IN (0,1)), | ||
priority INT NOT NULL, | ||
stored_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
); | ||
|
||
CREATE INDEX idx_stored_messages_destination_pubkey ON stored_messages (destination_pubkey); | ||
CREATE INDEX idx_stored_messages_destination_node_id ON stored_messages (destination_node_id); | ||
CREATE INDEX idx_stored_messages_stored_at ON stored_messages (stored_at); | ||
CREATE INDEX idx_stored_messages_priority ON stored_messages (priority); | ||
|
||
CREATE TABLE dht_settings ( | ||
id INTEGER PRIMARY KEY NOT NULL, | ||
key TEXT NOT NULL, | ||
value BLOB NOT NULL | ||
); | ||
|
||
CREATE UNIQUE INDEX idx_dht_settings_key ON dht_settings (key); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.