-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PSL-1207] implement recovery flows for cascade multi-vol registratio…
…n/activation
- Loading branch information
Showing
32 changed files
with
60,780 additions
and
56,354 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
44 changes: 44 additions & 0 deletions
44
common/storage/ticketstore/multi_vol_cascade_ticket_txid_map.go
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,44 @@ | ||
package ticketstore | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/pastelnetwork/gonode/common/types" | ||
) | ||
|
||
type MultiVolCascadeTicketMapQueries interface { | ||
InsertMultiVolCascadeTicketTxIDMap(m types.MultiVolCascadeTicketTxIDMap) error | ||
GetMultiVolCascadeTicketTxIDMap(baseFileID string) (*types.MultiVolCascadeTicketTxIDMap, error) | ||
} | ||
|
||
func (s *TicketStore) InsertMultiVolCascadeTicketTxIDMap(m types.MultiVolCascadeTicketTxIDMap) error { | ||
insertSQL := ` | ||
INSERT INTO multi_vol_cascade_tickets_txid_map (base_file_id, multi_vol_cascade_ticket_txid, created_at, updated_at) | ||
VALUES (?, ?, ?, ?)` | ||
stmt, err := s.db.Prepare(insertSQL) | ||
if err != nil { | ||
return err | ||
} | ||
defer stmt.Close() | ||
|
||
_, err = stmt.Exec(m.BaseFileID, m.MultiVolCascadeTicketTxid, time.Now().UTC(), time.Now().UTC()) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func (s *TicketStore) GetMultiVolCascadeTicketTxIDMap(baseFileID string) (*types.MultiVolCascadeTicketTxIDMap, error) { | ||
selectSQL := ` | ||
SELECT id, base_file_id, multi_vol_cascade_ticket_txid | ||
FROM multi_vol_cascade_tickets_txid_map | ||
WHERE base_file_id = ?` | ||
row := s.db.QueryRow(selectSQL, baseFileID) | ||
|
||
var ticket types.MultiVolCascadeTicketTxIDMap | ||
err := row.Scan(&ticket.ID, &ticket.BaseFileID, &ticket.MultiVolCascadeTicketTxid) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &ticket, nil | ||
} |
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
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.