2021-07-30 17:46:38 +02:00
|
|
|
package server
|
|
|
|
|
|
|
|
type Store interface {
|
2022-05-21 15:21:39 +02:00
|
|
|
GetAllAccounts() []*Account
|
2022-11-07 12:10:56 +01:00
|
|
|
GetAccount(accountID string) (*Account, error)
|
|
|
|
GetAccountByUser(userID string) (*Account, error)
|
|
|
|
GetAccountByPeerPubKey(peerKey string) (*Account, error)
|
2023-02-03 10:33:28 +01:00
|
|
|
GetAccountByPeerID(peerID string) (*Account, error)
|
2022-11-07 12:10:56 +01:00
|
|
|
GetAccountBySetupKey(setupKey string) (*Account, error) //todo use key hash later
|
2022-03-01 15:22:18 +01:00
|
|
|
GetAccountByPrivateDomain(domain string) (*Account, error)
|
2021-07-30 17:46:38 +02:00
|
|
|
SaveAccount(account *Account) error
|
2022-10-16 13:33:46 +02:00
|
|
|
GetInstallationID() string
|
2022-11-08 10:46:12 +01:00
|
|
|
SaveInstallationID(ID string) error
|
2022-11-07 17:52:23 +01:00
|
|
|
// AcquireAccountLock should attempt to acquire account lock and return a function that releases the lock
|
|
|
|
AcquireAccountLock(accountID string) func()
|
|
|
|
// AcquireGlobalLock should attempt to acquire a global lock and return a function that releases the lock
|
|
|
|
AcquireGlobalLock() func()
|
2023-02-03 10:33:28 +01:00
|
|
|
SavePeerStatus(accountID, peerID string, status PeerStatus) error
|
2022-11-08 10:46:12 +01:00
|
|
|
// Close should close the store persisting all unsaved data.
|
|
|
|
Close() error
|
2021-07-30 17:46:38 +02:00
|
|
|
}
|