-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11467 from filecoin-project/feat/correct-lp-messa…
…ge-send feat: lpmessage: Correct message sending
- Loading branch information
Showing
5 changed files
with
314 additions
and
83 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 |
---|---|---|
@@ -1,22 +1,55 @@ | ||
create table message_sends | ||
( | ||
from_key text not null, | ||
nonce bigint not null, | ||
to_addr text not null, | ||
signed_data bytea not null, | ||
signed_json jsonb not null, | ||
signed_cid text not null, | ||
send_time timestamp default CURRENT_TIMESTAMP, | ||
send_reason text, | ||
send_success bool default false not null, | ||
from_key text not null, | ||
to_addr text not null, | ||
send_reason text not null, | ||
send_task_id bigint not null, | ||
|
||
unsigned_data bytea not null, | ||
unsigned_cid text not null, | ||
|
||
nonce bigint, | ||
signed_data bytea, | ||
signed_json jsonb, | ||
signed_cid text, | ||
|
||
send_time timestamp default null, | ||
send_success boolean default null, | ||
send_error text, | ||
|
||
constraint message_sends_pk | ||
primary key (from_key, nonce) | ||
primary key (send_task_id, from_key) | ||
); | ||
|
||
comment on column message_sends.from_key is 'text f[1/3/4]... address'; | ||
comment on column message_sends.nonce is 'assigned message nonce'; | ||
comment on column message_sends.to_addr is 'text f[0/1/2/3/4]... address'; | ||
comment on column message_sends.signed_data is 'signed message data'; | ||
comment on column message_sends.signed_cid is 'signed message cid'; | ||
comment on column message_sends.send_reason is 'optional description of send reason'; | ||
comment on column message_sends.send_success is 'whether this message was broadcasted to the network already'; | ||
comment on column message_sends.send_task_id is 'harmony task id of the send task'; | ||
|
||
comment on column message_sends.unsigned_data is 'unsigned message data'; | ||
comment on column message_sends.unsigned_cid is 'unsigned message cid'; | ||
|
||
comment on column message_sends.nonce is 'assigned message nonce, set while the send task is executing'; | ||
comment on column message_sends.signed_data is 'signed message data, set while the send task is executing'; | ||
comment on column message_sends.signed_cid is 'signed message cid, set while the send task is executing'; | ||
|
||
comment on column message_sends.send_time is 'time when the send task was executed, set after pushing the message to the network'; | ||
comment on column message_sends.send_success is 'whether this message was broadcasted to the network already, null if not yet attempted, true if successful, false if failed'; | ||
comment on column message_sends.send_error is 'error message if send_success is false'; | ||
|
||
create unique index message_sends_success_index | ||
on message_sends (from_key, nonce) | ||
where send_success is not false; | ||
|
||
comment on index message_sends_success_index is | ||
'message_sends_success_index enforces sender/nonce uniqueness, it is a conditional index that only indexes rows where send_success is not false. This allows us to have multiple rows with the same sender/nonce, as long as only one of them was successfully broadcasted (true) to the network or is in the process of being broadcasted (null).'; | ||
|
||
create table message_send_locks | ||
( | ||
from_key text not null, | ||
task_id bigint not null, | ||
claimed_at timestamp not null, | ||
|
||
constraint message_send_locks_pk | ||
primary key (from_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
Oops, something went wrong.