account

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAvatarSize = 1 << 16
	TouchInterval = time.Minute * 15
	AccDbKeyHead  = "account_0"
	AccDbKeyEnd   = "account_1"
)
View Source
const (
	FriDbKeyStart = "account_friend_0"
	FriDbKeyEnd   = "account_friend_1"
)
View Source
const (
	GrpRelationDbKeyStart = "account_group_0"
	GrpRelationDbKeyEnd   = "account_group_1"
)
View Source
const (
	StorageTaskSize  = 1024
	DirOfAccountData = "account"
	MetaDelFlag      = '-'
)
View Source
const (
	GrpDbKeyStart = "group_0"
	GrpDbKeyEnd   = "group_1"
)

Variables

View Source
var (
	ErrInvalidMeta  = fmt.Errorf("invalid meta data")
	ErrAvatarTooBig = fmt.Errorf("avatar size is out of limitation")
	ErrGasLow       = fmt.Errorf("insufficient funds")
	ErrNotFound     = fmt.Errorf("not found")
	ErrGrpNoRight   = fmt.Errorf("group no right")
	ErrGrpUnknown   = fmt.Errorf("group operation unknown")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	Nonce     int64       `json:"nonce"`
	Addr      string      `json:"addr"`
	NickName  string      `json:"name"`
	Avatar    []byte      `json:"avatar,omitempty"`
	Balance   *big.Int    `json:"balance"`
	TouchTime time.Time   `json:"touch_time"`
	Hash      common.Hash `json:"-"`
}

func (*Account) CompareTo

func (a *Account) CompareTo(b *Account) int

func (*Account) IsVip

func (a *Account) IsVip() bool

func (*Account) RawData

func (a *Account) RawData() []byte

func (*Account) String

func (a *Account) String() string

type ChatGroup

type ChatGroup struct {
	Nonce   int64           `json:"nonce"`
	GroupID string          `json:"gid"`
	Owner   string          `json:"owner"`
	Name    string          `json:"name"`
	Deleted bool            `json:"deleted"`
	Members map[string]bool `json:"members"`
}

func (*ChatGroup) Hash

func (cg *ChatGroup) Hash() common.Hash

func (*ChatGroup) RawData

func (cg *ChatGroup) RawData() []byte

func (*ChatGroup) String

func (cg *ChatGroup) String() string

type Contact

type Contact struct {
	*Account     `json:"account,omitempty"`
	*FriendsDemo `json:"demo,omitempty"`
}

func (*Contact) RawData

func (c *Contact) RawData() []byte

func (*Contact) String

func (c *Contact) String() string

type FriendRelation

type FriendRelation struct {
	Addr    string                  `json:"address"`
	Friends map[string]*FriendsDemo `json:"demo"`
}

func (*FriendRelation) RawData

func (fr *FriendRelation) RawData() []byte

func (*FriendRelation) String

func (fr *FriendRelation) String() string

type FriendsDemo

type FriendsDemo struct {
	Alias  string `json:"alias"`
	Remark string `json:"remark"`
}

func (*FriendsDemo) RawData

func (fd *FriendsDemo) RawData() []byte

func (*FriendsDemo) String

func (fd *FriendsDemo) String() string

type GroupRelation

type GroupRelation struct {
	Addr   string          `json:"addr"`
	Groups map[string]bool `json:"groups"`
}

func (*GroupRelation) RawData

func (gr *GroupRelation) RawData() []byte

func (*GroupRelation) String

func (gr *GroupRelation) String() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func Inst

func Inst() *Manager

func (*Manager) BalanceByBlockChain

func (am *Manager) BalanceByBlockChain(uid string, b int64) error

func (*Manager) FriendOperate

func (am *Manager) FriendOperate(isLocal bool, meta *pbs.FriendMeta) error

func (*Manager) GetAccount

func (am *Manager) GetAccount(addr string) *Account

func (*Manager) GetGroupByID

func (am *Manager) GetGroupByID(gid string) *ChatGroup

func (*Manager) GetOneOfFriendRelation

func (am *Manager) GetOneOfFriendRelation(owner, fid string) *FriendsDemo

func (*Manager) GetOrCreateFriendRelation

func (am *Manager) GetOrCreateFriendRelation(addr string, create bool) *FriendRelation

func (*Manager) GetOrCreateGrpRelations

func (am *Manager) GetOrCreateGrpRelations(addr string, create bool) *GroupRelation

func (*Manager) GroupOperate

func (am *Manager) GroupOperate(isLocal bool, meta *pbs.GroupMeta) error

func (*Manager) StoreWorker

func (am *Manager) StoreWorker(stop chan struct{})

func (*Manager) UpdateAccount

func (am *Manager) UpdateAccount(isLocal bool, meta *pbs.AccountMeta) error

func (*Manager) UpdateAccountBySyncedData

func (am *Manager) UpdateAccountBySyncedData(data []byte) error

func (*Manager) UpdateFriRelBySyncedData

func (am *Manager) UpdateFriRelBySyncedData(data []byte) error

func (*Manager) UpdateGroupBySyncedData

func (am *Manager) UpdateGroupBySyncedData(data []byte) error

func (*Manager) UpdateGrpRelBySyncedData

func (am *Manager) UpdateGrpRelBySyncedData(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL