metadata

package
v1.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const BudgetBonus = 10
View Source
const GlobalBudget = 1000000
View Source
const MaxBoostrapResponseSize = 1024 * 1024 // TODO move somewhere
View Source
const MaxBudget = 1000
View Source
const StepSec = 3600

Variables

This section is empty.

Functions

func BackupTimeStat

func BackupTimeStat(d time.Duration, err error)

Types

type DBV2

type DBV2 struct {
	MustCommitEveryReq bool
	// contains filtered or unexported fields
}

func OpenDB

func OpenDB(
	path string,
	opt Options,
	binlog binlog2.Binlog) (*DBV2, error)

func (*DBV2) Close

func (db *DBV2) Close() error

func (*DBV2) GetBootstrap

func (db *DBV2) GetBootstrap() (tlstatshouse.GetTagMappingBootstrapResult, error)

func (*DBV2) GetMappingByID

func (db *DBV2) GetMappingByID(id int32) (string, bool, error)

func (*DBV2) GetMappingByValue

func (db *DBV2) GetMappingByValue(key string) (int32, bool, error)

func (*DBV2) GetOrCreateMapping

func (db *DBV2) GetOrCreateMapping(metricName, key string) (tlmetadata.GetMappingResponseUnion, error)

func (*DBV2) JournalEvents

func (db *DBV2) JournalEvents(sinceVersion int64, page int64) ([]tlmetadata.Event, error)

func (*DBV2) PrintAllMappings

func (db *DBV2) PrintAllMappings() error

TODO - remove after debug or leave for the future

func (*DBV2) PutBootstrap

func (db *DBV2) PutBootstrap(mappings []tlstatshouse.Mapping) (int32, error)

func (*DBV2) PutMapping

func (db *DBV2) PutMapping(ks []string, vs []int32) error

func (*DBV2) PutOldMetric

func (db *DBV2) PutOldMetric(name string, id int64, versionToInsert int64, newJson string, updateTime uint32, typ int32) (tlmetadata.Event, error)

func (*DBV2) ResetFlood

func (db *DBV2) ResetFlood(metric string) error

func (*DBV2) SaveEntity

func (db *DBV2) SaveEntity(name string, id int64, oldVersion int64, newJson string, createMetric, deleteEntity bool, typ int32) (tlmetadata.Event, error)

type EngineRpcHandler

type EngineRpcHandler struct {
	SignalCh chan os.Signal
	// contains filtered or unexported fields
}

func NewEngineRpcHandler

func NewEngineRpcHandler(binlogPrefix string, db *DBV2) *EngineRpcHandler

func (*EngineRpcHandler) Backup

func (h *EngineRpcHandler) Backup(prefix string) error

func (*EngineRpcHandler) GetBinlogPrefixes

func (*EngineRpcHandler) GetReindexStatus

func (*EngineRpcHandler) SendSignal

func (h *EngineRpcHandler) SendSignal(ctx context.Context, args tlengine.SendSignal) (tl.True, error)

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(db *DBV2, host string, log func(s string, args ...interface{})) *Handler

func (*Handler) RawEditEntity

func (h *Handler) RawEditEntity(ctx context.Context, hctx *rpc.HandlerContext) (string, error)

func (*Handler) RawGetJournal

func (h *Handler) RawGetJournal(ctx context.Context, hctx *rpc.HandlerContext) (string, error)

func (*Handler) RawGetMappingByID

func (h *Handler) RawGetMappingByID(ctx context.Context, hctx *rpc.HandlerContext) (string, error)

func (*Handler) RawGetMappingByValue

func (h *Handler) RawGetMappingByValue(ctx context.Context, hctx *rpc.HandlerContext) (string, error)

func (*Handler) RawPutMapping

func (h *Handler) RawPutMapping(ctx context.Context, hctx *rpc.HandlerContext) (string, error)

func (*Handler) RawResetFlood

func (h *Handler) RawResetFlood(ctx context.Context, hctx *rpc.HandlerContext) (string, error)

resetFlood

func (*Handler) ResetFlood2

type Options

type Options struct {
	Host string

	MaxBudget    int64
	StepSec      uint32
	BudgetBonus  int64
	GlobalBudget int64

	MetricValidationFunc func(oldJson, newJson string) error
	Now                  func() time.Time
}

type ProxyHandler

type ProxyHandler struct {
	Host string
}

func (*ProxyHandler) HandleProxy

func (h *ProxyHandler) HandleProxy(name string, f RpcMethod) func(ctx context.Context, hctx *rpc.HandlerContext) error

type RpcMethod

type RpcMethod func(ctx context.Context, hctx *rpc.HandlerContext) (status string, err error)

Jump to

Keyboard shortcuts

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