专栏名称: go4it
目录
相关文章推荐
中国证券报  ·  13:40,A股发生了什么? ·  11 小时前  
开发者全社区  ·  逛街遇到两个已婚领导约会 ·  19 小时前  
开发者全社区  ·  人大文科毕业生收入待遇汇总 ·  19 小时前  
中国证券报  ·  青睐小米、比亚迪!韩国股民,加仓中国资产 ·  3 天前  
中国证券报  ·  联手宁德时代!富临精工新动作 ·  3 天前  
51好读  ›  专栏  ›  go4it

聊聊promtail的positions

go4it  · 掘金  ·  · 2021-01-21 23:54

正文

阅读 47

聊聊promtail的positions

本文主要研究一下promtail的positions

Positions

loki/pkg/promtail/positions/positions.go

type Positions interface {
	// GetString returns how far we've through a file as a string.
	// JournalTarget writes a journal cursor to the positions file, while
	// FileTarget writes an integer offset. Use Get to read the integer
	// offset.
	GetString(path string) string
	// Get returns how far we've read through a file. Returns an error
	// if the value stored for the file is not an integer.
	Get(path string) (int64, error)
	// PutString records (asynchronously) how far we've read through a file.
	// Unlike Put, it records a string offset and is only useful for
	// JournalTargets which doesn't have integer offsets.
	PutString(path string, pos string)
	// Put records (asynchronously) how far we've read through a file.
	Put(path string, pos int64)
	// Remove removes the position tracking for a filepath
	Remove(path string)
	// SyncPeriod returns how often the positions file gets resynced
	SyncPeriod() time.Duration
	// Stop the Position tracker.
	Stop()
}
复制代码

Positions接口定义了GetString、Get、PutString、Put、Remove、SyncPeriod、Stop方法

positions

loki/pkg/promtail/positions/positions.go







请到「今天看啥」查看全文