utils

package
v4.1.23 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Day  = 24 * time.Hour
	Week = 7 * Day
	Year = 365 * Day
)

Variables

View Source
var (
	Tag        string
	GitHash    string
	BuildStamp string
)
View Source
var Timeframes = []*Timeframe{
	{"1Sec", time.Second},
	{"10Sec", 10 * time.Second},
	{"30Sec", 30 * time.Second},
	{"1Min", time.Minute},
	{"5Min", 5 * time.Minute},
	{"15Min", 15 * time.Minute},
	{"30Min", 30 * time.Minute},
	{"1H", time.Hour},
	{"4H", 4 * time.Hour},
	{"2H", 2 * time.Hour},
	{"1D", Day},
}

Functions

This section is empty.

Types

type BgWorkerSetting

type BgWorkerSetting struct {
	Module string
	Name   string
	Config map[string]interface{}
}

type CandleDuration

type CandleDuration struct {
	String string
	// contains filtered or unexported fields
}

func CandleDurationFromString

func CandleDurationFromString(tf string) (cd *CandleDuration, err error)

func (*CandleDuration) Ceil

func (cd *CandleDuration) Ceil(ts time.Time) time.Time

Ceil returns the upper boundary time of this candle window that ts belongs to.

func (*CandleDuration) Duration

func (cd *CandleDuration) Duration() time.Duration

func (*CandleDuration) IsWithin

func (cd *CandleDuration) IsWithin(ts, start time.Time) bool

func (*CandleDuration) QueryableNrecords

func (cd *CandleDuration) QueryableNrecords(tf string, nrecords int) int

func (*CandleDuration) QueryableTimeframe

func (cd *CandleDuration) QueryableTimeframe() string

func (*CandleDuration) Truncate

func (cd *CandleDuration) Truncate(ts time.Time) time.Time

Truncate returns the lower boundary time of this candle window that ts belongs to.

type MktsConfig

type MktsConfig struct {
	// RootDirectory is the absolute path to the data directory
	RootDirectory              string
	ListenURL                  string
	GRPCListenURL              string
	GRPCMaxSendMsgSize         int // in bytes
	GRPCMaxRecvMsgSize         int // in bytes
	UtilitiesURL               string
	Timezone                   *time.Location
	StopGracePeriod            time.Duration
	WALRotateInterval          int
	DisableVariableCompression bool
	InitCatalog                bool
	InitWALCache               bool
	BackgroundSync             bool
	WALBypass                  bool
	StartTime                  time.Time
	Replication                ReplicationSetting
	Triggers                   []*TriggerSetting
	BgWorkers                  []*BgWorkerSetting
}
var InstanceConfig MktsConfig

func NewDefaultConfig added in v4.1.18

func NewDefaultConfig(rootDir string) *MktsConfig

func ParseConfig added in v4.1.18

func ParseConfig(data []byte) (*MktsConfig, error)

type ReplicationSetting added in v4.1.0

type ReplicationSetting struct {
	Enabled           bool
	TLSEnabled        bool
	CertFile          string
	KeyFile           string
	ListenPort        int
	MasterHost        string
	RetryInterval     time.Duration
	RetryBackoffCoeff int
}

type Timeframe

type Timeframe struct {
	String   string
	Duration time.Duration
}

func NewTimeframe

func NewTimeframe(arg interface{}) (tf *Timeframe)

func TimeframeFromDuration

func TimeframeFromDuration(tf time.Duration) *Timeframe

func TimeframeFromString

func TimeframeFromString(tf string) *Timeframe

func (*Timeframe) PeriodsPerDay

func (tf *Timeframe) PeriodsPerDay() int

type TriggerSetting

type TriggerSetting struct {
	Module string
	On     string
	Config map[string]interface{}
}

Directories

Path Synopsis
rpc

Jump to

Keyboard shortcuts

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