Documentation ¶
Index ¶
- Constants
- Variables
- type AccessibleFilter
- type ConsistencyFilter
- type ConsumerFilter
- type ContextKey
- type DependencyRuleCache
- type DependencyRuleItem
- type FindInstancesCache
- func (f *FindInstancesCache) Get(ctx context.Context, consumer *pb.MicroService, provider *pb.MicroServiceKey, ...) (*VersionRuleCacheItem, error)
- func (f *FindInstancesCache) GetWithProviderID(ctx context.Context, consumer *pb.MicroService, provider *pb.MicroServiceKey, ...) (*VersionRuleCacheItem, error)
- func (f *FindInstancesCache) Remove(provider *pb.MicroServiceKey)
- type InstancesFilter
- func (f *InstancesFilter) BatchFindInstances(ctx context.Context, domainProject string, serviceIDs []string) (instances []*pb.MicroServiceInstance, rev string, err error)
- func (f *InstancesFilter) Find(ctx context.Context, parent *cache.Node) (instances []*pb.MicroServiceInstance, rev string, err error)
- func (f *InstancesFilter) FindInstances(ctx context.Context, domainProject string, instanceKey *pb.HeartbeatSetElement) (instances []*pb.MicroServiceInstance, rev string, err error)
- func (f *InstancesFilter) Init(ctx context.Context, parent *cache.Node) (node *cache.Node, err error)
- func (f *InstancesFilter) Name(ctx context.Context, _ *cache.Node) string
- type ServiceFilter
- type TagsFilter
- type VersionRuleCacheItem
- type VersionRuleFilter
Constants ¶
View Source
const ( CtxFindConsumer ContextKey = "_consumer" CtxFindProvider ContextKey = "_provider" CtxFindProviderInstance ContextKey = "_provider_instance" CtxFindTags ContextKey = "_tags" CtxFindRequestRev ContextKey = "_rev" Find = "_find" Dep = "_dep" DefaultCacheMaxSize = 10000 )
Variables ¶
View Source
var DependencyRule = &DependencyRuleCache{ Tree: cache.NewTree(cache.Configure(). WithMaxSize(DefaultCacheMaxSize))}
View Source
var FindInstances = &FindInstancesCache{ Tree: cache.NewTree(cache.Configure(). WithTTL(2 * time.Minute). WithMaxSize(DefaultCacheMaxSize))}
Functions ¶
This section is empty.
Types ¶
type ConsistencyFilter ¶
type ConsistencyFilter struct {
InstancesFilter
}
ConsistencyFilter improves consistency. Scenario: cache maybe different between several service-centers.
func (*ConsistencyFilter) Init ¶
func (f *ConsistencyFilter) Init(ctx context.Context, parent *cache.Node) (node *cache.Node, err error)
Init generates cache. We think cache inconsistency happens and correction is needed only when the revision in the request is not empty and different from the revision of parent cache. To correct inconsistency, RevisionFilter skips cache and get data from the backend directly to response. It's impossible to guarantee consistency if the backend is not creditable, thus in this condition RevisionFilter uses cache only.
type ContextKey ¶
type ContextKey string
type DependencyRuleCache ¶
func (*DependencyRuleCache) ExistVersionRule ¶
func (f *DependencyRuleCache) ExistVersionRule(ctx context.Context, consumerID string, provider *pb.MicroServiceKey) bool
func (*DependencyRuleCache) Remove ¶
func (f *DependencyRuleCache) Remove(provider *pb.MicroServiceKey)
type DependencyRuleItem ¶
type DependencyRuleItem struct {
VersionRule string
}
type FindInstancesCache ¶
func (*FindInstancesCache) Get ¶
func (f *FindInstancesCache) Get(ctx context.Context, consumer *pb.MicroService, provider *pb.MicroServiceKey, tags []string, rev string) (*VersionRuleCacheItem, error)
func (*FindInstancesCache) GetWithProviderID ¶
func (f *FindInstancesCache) GetWithProviderID(ctx context.Context, consumer *pb.MicroService, provider *pb.MicroServiceKey, instanceKey *pb.HeartbeatSetElement, tags []string, rev string) (*VersionRuleCacheItem, error)
func (*FindInstancesCache) Remove ¶
func (f *FindInstancesCache) Remove(provider *pb.MicroServiceKey)
type InstancesFilter ¶
type InstancesFilter struct { }
func (*InstancesFilter) BatchFindInstances ¶
func (f *InstancesFilter) BatchFindInstances(ctx context.Context, domainProject string, serviceIDs []string) (instances []*pb.MicroServiceInstance, rev string, err error)
func (*InstancesFilter) Find ¶
func (f *InstancesFilter) Find(ctx context.Context, parent *cache.Node) ( instances []*pb.MicroServiceInstance, rev string, err error)
func (*InstancesFilter) FindInstances ¶
func (f *InstancesFilter) FindInstances(ctx context.Context, domainProject string, instanceKey *pb.HeartbeatSetElement) (instances []*pb.MicroServiceInstance, rev string, err error)
type VersionRuleCacheItem ¶
type VersionRuleCacheItem struct { ServiceIds []string Instances []*pb.MicroServiceInstance Rev string // contains filtered or unexported fields }
func (*VersionRuleCacheItem) Broken ¶
func (vi *VersionRuleCacheItem) Broken()
func (*VersionRuleCacheItem) BrokenWait ¶
func (vi *VersionRuleCacheItem) BrokenWait() bool
func (*VersionRuleCacheItem) InitBrokenQueue ¶
func (vi *VersionRuleCacheItem) InitBrokenQueue()
Click to show internal directories.
Click to hide internal directories.