MCPcopy Index your code
hub / github.com/deepflowio/deepflow / NewCache

Function NewCache

server/controller/recorder/cache/cache.go:98–112  ·  view source on GitHub ↗
(ctx context.Context, md *rcommon.Metadata, selfHealInterval time.Duration)

Source from the content-addressed store, hash-verified

96}
97
98func NewCache(ctx context.Context, md *rcommon.Metadata, selfHealInterval time.Duration) *Cache {
99 c := &Cache{
100 ctx: ctx,
101
102 metadata: md,
103
104 SelfHealInterval: selfHealInterval + time.Duration(rand.Intn(60))*time.Minute, // add random interval to avoid all cache refresh at once
105 RefreshSignal: make(chan struct{}, 1),
106 DiffBaseDataSet: diffbase.NewDataSet(md), // 所有资源的主要信息,用于与cloud数据比较差异,根据差异更新资源
107 ToolDataSet: tool.NewDataSet(md), // 各类资源的映射关系,用于按需进行数据转换
108 }
109 c.tagrecorderHealers = tagrecorderHealer.NewHealers(md.Platform)
110 c.StartSelfHealing()
111 return c
112}
113
114func (c *Cache) GetMetadata() *rcommon.Metadata {
115 return c.metadata

Callers 2

NewCacheManagerFunction · 0.70

Calls 1

StartSelfHealingMethod · 0.95

Tested by

no test coverage detected