Documentation ¶
Overview ¶
package storenodes provides functionality to work with community specific storenodes Current limitations: - we support only one storenode per community - we assume that the storenode is always active - we don't support a way to regularly check connection similar to the `messenger_mailserver_cycle.go`
Index ¶
- Variables
- type CommunityStorenodes
- func (m *CommunityStorenodes) GetStorenodeByCommunnityID(communityID string) (mailservers.Mailserver, error)
- func (m *CommunityStorenodes) GetStorenodesFromDB(communityID types.HexBytes) ([]Storenode, error)
- func (m *CommunityStorenodes) HasStorenodeSetup(communityID string) bool
- func (m *CommunityStorenodes) IsCommunityStoreNode(id string) bool
- func (m *CommunityStorenodes) ReloadFromDB() error
- func (m *CommunityStorenodes) UpdateStorenodesInDB(communityID types.HexBytes, snodes []Storenode, clock uint64) error
- type Database
- type Storenode
- type Storenodes
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
This section is empty.
Types ¶
type CommunityStorenodes ¶
type CommunityStorenodes struct {
// contains filtered or unexported fields
}
CommunityStorenodes has methods to handle the storenodes for a community
func NewCommunityStorenodes ¶
func NewCommunityStorenodes(storenodesDB *Database, logger *zap.Logger) *CommunityStorenodes
func (*CommunityStorenodes) GetStorenodeByCommunnityID ¶
func (m *CommunityStorenodes) GetStorenodeByCommunnityID(communityID string) (mailservers.Mailserver, error)
GetStorenodeByCommunnityID returns the active storenode for a community
func (*CommunityStorenodes) GetStorenodesFromDB ¶
func (m *CommunityStorenodes) GetStorenodesFromDB(communityID types.HexBytes) ([]Storenode, error)
func (*CommunityStorenodes) HasStorenodeSetup ¶
func (m *CommunityStorenodes) HasStorenodeSetup(communityID string) bool
func (*CommunityStorenodes) IsCommunityStoreNode ¶
func (m *CommunityStorenodes) IsCommunityStoreNode(id string) bool
func (*CommunityStorenodes) ReloadFromDB ¶
func (m *CommunityStorenodes) ReloadFromDB() error
ReloadFromDB loads or reloads the mailservers from the database (on adding/deleting mailservers)
func (*CommunityStorenodes) UpdateStorenodesInDB ¶
type Storenode ¶
type Storenode struct { CommunityID types.HexBytes `json:"community_id"` StorenodeID string `json:"storenode_id"` Name string `json:"name"` Address multiaddr.Multiaddr `json:"address"` Fleet string `json:"fleet"` Version uint `json:"version"` Clock uint64 `json:"-"` // used to sync Removed bool `json:"-"` DeletedAt int64 `json:"-"` }
Storenode is a struct that represents a storenode, it is very closely related to `mailservers.Mailserver`
type Storenodes ¶
type Storenodes []Storenode
func FromProtobuf ¶
func FromProtobuf(storenodes []*protobuf.Storenode, clock uint64) Storenodes
func (Storenodes) ToProtobuf ¶
func (m Storenodes) ToProtobuf() []*protobuf.Storenode