uidmap

package
v5.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: BSD-3-Clause, BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentFullNamePackageVersion = keybase1.FullNamePackageVersion_V2
View Source
const DefaultNetworkBudget = time.Duration(0)

DefaultNetworkBudget is a networkBudget const which will make the request use default timeout / retry settings.

View Source
const DisallowNetworkBudget = time.Duration(1)

DisallowNetworkBudget is a networkBudget const equal to 1 ns, where we won't even bother making a request that would inevitably not finish in time.

Variables

This section is empty.

Functions

func MapUIDsReturnMap added in v1.0.39

func MapUIDsReturnMap(ctx context.Context, u libkb.UIDMapper, g libkb.UIDMapperContext, uids []keybase1.UID, fullNameFreshness time.Duration,
	networkTimeBudget time.Duration, forceNetworkForFullNames bool) (res map[keybase1.UID]libkb.UsernamePackage, err error)

func MapUIDsReturnMapMctx

func MapUIDsReturnMapMctx(mctx libkb.MetaContext, uids []keybase1.UID, fullNameFreshness time.Duration, networkTimeBudget time.Duration,
	forceNetworkForFullNames bool) (res map[keybase1.UID]libkb.UsernamePackage, err error)

Types

type OfflineServiceSummaryMap

type OfflineServiceSummaryMap struct{}

func NewOfflineServiceSummaryMap

func NewOfflineServiceSummaryMap() *OfflineServiceSummaryMap

func (*OfflineServiceSummaryMap) InformOfServiceSummary

func (s *OfflineServiceSummaryMap) InformOfServiceSummary(ctx context.Context, g libkb.UIDMapperContext,
	uid keybase1.UID, summary libkb.UserServiceSummary) error

func (*OfflineServiceSummaryMap) MapUIDsToServiceSummaries

func (s *OfflineServiceSummaryMap) MapUIDsToServiceSummaries(ctx context.Context, g libkb.UIDMapperContext, uids []keybase1.UID,
	freshness time.Duration, networkTimeBudget time.Duration) (res map[keybase1.UID]libkb.UserServiceSummaryPackage)

type OfflineUIDMap added in v1.0.34

type OfflineUIDMap struct{}

func (*OfflineUIDMap) CheckUIDAgainstUsername added in v1.0.34

func (o *OfflineUIDMap) CheckUIDAgainstUsername(uid keybase1.UID, un libkb.NormalizedUsername) bool

func (*OfflineUIDMap) ClearUIDAtEldestSeqno added in v1.0.34

func (o *OfflineUIDMap) ClearUIDAtEldestSeqno(ctx context.Context, g libkb.UIDMapperContext, uid keybase1.UID, s keybase1.Seqno) error

func (*OfflineUIDMap) InformOfEldestSeqno added in v1.0.40

func (o *OfflineUIDMap) InformOfEldestSeqno(ctx context.Context, g libkb.UIDMapperContext, uv keybase1.UserVersion) (bool, error)

func (*OfflineUIDMap) MapHardcodedUsernameToUID

func (o *OfflineUIDMap) MapHardcodedUsernameToUID(un libkb.NormalizedUsername) keybase1.UID

func (*OfflineUIDMap) MapUIDsToUsernamePackages added in v1.0.34

func (o *OfflineUIDMap) MapUIDsToUsernamePackages(ctx context.Context, g libkb.UIDMapperContext, uids []keybase1.UID, fullNameFreshness time.Duration, networktimeBudget time.Duration, forceNetworkForFullNames bool) ([]libkb.UsernamePackage, error)

func (*OfflineUIDMap) MapUIDsToUsernamePackagesOffline

func (o *OfflineUIDMap) MapUIDsToUsernamePackagesOffline(ctx context.Context, g libkb.UIDMapperContext, uids []keybase1.UID, fullNameFreshness time.Duration) (res []libkb.UsernamePackage, err error)

func (*OfflineUIDMap) SetTestingNoCachingMode added in v1.0.34

func (o *OfflineUIDMap) SetTestingNoCachingMode(enabled bool)

type ServiceSummaryMap

type ServiceSummaryMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewServiceSummaryMap

func NewServiceSummaryMap(memSize int) *ServiceSummaryMap

func (*ServiceSummaryMap) InformOfServiceSummary

func (s *ServiceSummaryMap) InformOfServiceSummary(ctx context.Context, g libkb.UIDMapperContext,
	uid keybase1.UID, summary libkb.UserServiceSummary) error

func (*ServiceSummaryMap) MapUIDsToServiceSummaries

func (s *ServiceSummaryMap) MapUIDsToServiceSummaries(ctx context.Context, g libkb.UIDMapperContext, uids []keybase1.UID,
	freshness time.Duration, networkTimeBudget time.Duration) (res map[keybase1.UID]libkb.UserServiceSummaryPackage)

MapUIDsToServiceSummaries retrieves serviceMap for uids.

- `freshness` determines time duration after which data is considered stale and will be re-fetched (or not returned, depending if network requests are possible and allowed). Default value of 0 makes all data eligible to return no matter how old.

- `networkTimeBudget` sets the timeout for network request. Default value of 0 triggers the default API behavior. Special value `DisallowNetworkBudget` (equal to tiny budget of 1 nanosecond) disallows any network access and will result in only cached data being returned.

If UID is present as a key in the result map, it means that it was either found in cache or fetched from API server. The value for the key may be nil, though, it means that the user has no services proven. To summarize, there is a possibility that not all `uids` will be present as keys in the result map, and also that not all keys will have non-nil value.

This function does not return errors, but it might not return any requested values if neither cache nor API connection is available.

type UIDMap

type UIDMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewUIDMap

func NewUIDMap(fullNameCacheSize int) *UIDMap

func (*UIDMap) CheckUIDAgainstUsername

func (u *UIDMap) CheckUIDAgainstUsername(uid keybase1.UID, un libkb.NormalizedUsername) bool

func (*UIDMap) Clear

func (u *UIDMap) Clear()

func (*UIDMap) ClearUIDAtEldestSeqno added in v1.0.34

func (u *UIDMap) ClearUIDAtEldestSeqno(ctx context.Context, g libkb.UIDMapperContext, uid keybase1.UID, s keybase1.Seqno) error

func (*UIDMap) InformOfEldestSeqno added in v1.0.40

func (u *UIDMap) InformOfEldestSeqno(ctx context.Context, g libkb.UIDMapperContext, uv keybase1.UserVersion) (isCurrent bool, err error)

InformOfEldestSeqno informs the mapper of an up-to-date (uid,eldestSeqno) pair. If the cache has a different value, it will clear the cache and then plumb the pair all the way through to the server, whose cache may also be in need of busting. Will return true if the cached value was up-to-date, and false otherwise.

func (*UIDMap) MapHardcodedUsernameToUID

func (u *UIDMap) MapHardcodedUsernameToUID(un libkb.NormalizedUsername) keybase1.UID

func (*UIDMap) MapUIDsToUsernamePackages

func (u *UIDMap) MapUIDsToUsernamePackages(ctx context.Context, g libkb.UIDMapperContext,
	uids []keybase1.UID, fullNameFreshness, networkTimeBudget time.Duration,
	forceNetworkForFullNames bool) (res []libkb.UsernamePackage, err error)

MapUIDsToUsernamePackages maps the given set of UIDs to the username packages, which include a username and a fullname, and when the mapping was loaded from the server. It blocks on the network until all usernames are known. If the `forceNetworkForFullNames` flag is specified, it will block on the network too. If the flag is not specified, then stale values (or unknown values) are OK, we won't go to network if we lack them. All network calls are limited by the given timeBudget, or if 0 is specified, there is indefinite budget. In the response, a nil FullNamePackage means that the lookup failed. A non-nil FullNamePackage means that some previous lookup worked, but might be arbitrarily out of date (depending on the cachedAt time). A non-nil FullNamePackage with an empty fullName field means that the user just hasn't supplied a fullName. FullNames can be cached by the UIDMap, but expire after networkTimeBudget duration. If that value is 0, then infinitely stale names are allowed. If non-zero, and some names aren't stale, we'll have to go to the network.

*NOTE* that this function can return useful data and an error. In this regard, the error is more like a warning. But if, for instance, the mapper runs out of time budget, it will return the data it was able to get, and also the error.

func (*UIDMap) MapUIDsToUsernamePackagesOffline

func (u *UIDMap) MapUIDsToUsernamePackagesOffline(ctx context.Context, g libkb.UIDMapperContext,
	uids []keybase1.UID, fullNameFreshness time.Duration) (res []libkb.UsernamePackage, err error)

func (*UIDMap) SetTestingNoCachingMode added in v1.0.34

func (u *UIDMap) SetTestingNoCachingMode(enabled bool)

Jump to

Keyboard shortcuts

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