Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCliFlags ¶
NewCliFlags returns cli flags to configure a core client.
Types ¶
type AddrHeap ¶
type AddrHeap []AddrNode
AddrHeap is a min-heap of AddrNode
type CachedClient ¶
CachedClient is the wrapper of User Profile Client with caching ability.
func NewCachedClient ¶
func NewCachedClient(client *Client, maxCache int64) *CachedClient
NewCachedClient creates a new User Profile cached client instance.
func NewCachedClientFromContext ¶
func NewCachedClientFromContext(client *Client, c *cli.Context) *CachedClient
NewCachedClientFromContext return new cached client from cli flags
func (*CachedClient) LookUpCache ¶
func (cc *CachedClient) LookUpCache(addr ethereum.Address) (UserProfile, bool)
LookUpCache will lookup the Userprofile from cache
func (*CachedClient) LookUpUserProfile ¶
func (cc *CachedClient) LookUpUserProfile(addr ethereum.Address) (UserProfile, error)
LookUpUserProfile will look for the UserProfile of input addr in cache first If this fail then it will query from endpoint
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the the implementation to query userprofile info.
func NewClient ¶
func NewClient(sugar *zap.SugaredLogger, url, signingKey string) (*Client, error)
NewClient creates a new core client instance.
func NewClientFromContext ¶
NewClientFromContext returns new core client from cli flags.
func (*Client) LookUpUserProfile ¶
func (c *Client) LookUpUserProfile(addr ethereum.Address) (UserProfile, error)
LookUpUserProfile will look for the UserProfile of input addr from server
type Interface ¶
type Interface interface {
LookUpUserProfile(addr ethereum.Address) (UserProfile, error)
}
Interface define functionality of this package
type MockClient ¶
type MockClient struct{}
MockClient is the mock implementation of user profile Interface
func (MockClient) LookUpUserProfile ¶
func (m MockClient) LookUpUserProfile(addr ethereum.Address) (UserProfile, error)
LookUpUserProfile return mockUserName and MockID for testing purpose
type UserProfile ¶
UserProfile contain infos of a user