filesource

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package filesource created on 2017/6/22.

Index

Constants

View Source
const (
	//FileConfigSourceConst is a variable of type string.
	FileConfigSourceConst = "FileSource"

	//DefaultFilePriority is a variable of type string.
	DefaultFilePriority = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigInfo

type ConfigInfo struct {
	FilePath string
	Value    interface{}
}

ConfigInfo is s struct.

type FileSource

type FileSource interface {
	source.ConfigSource
	AddFile(filePath string, priority uint32, handler util.FileHandler) error
}

FileSource is a interface.

func NewFileSource

func NewFileSource() FileSource

NewFileSource creates a source which can handler local files.

type FileSourceTypes

type FileSourceTypes string

FileSourceTypes is a string.

const (
	//RegularFile is a variable of type string.
	RegularFile FileSourceTypes = "RegularFile"
	//Directory is a variable of type string.
	Directory FileSourceTypes = "Directory"
	//InvalidFileType is a variable of type string.
	InvalidFileType FileSourceTypes = "InvalidType"
)

type Source

type Source struct {
	Configurations map[string]*ConfigInfo

	sync.RWMutex
	// contains filtered or unexported fields
}

Source is file source.

func (*Source) AddDimensionInfo

func (fSource *Source) AddDimensionInfo(_ map[string]string) error

AddDimensionInfo is none function.

func (*Source) AddFile

func (fSource *Source) AddFile(p string, priority uint32, handle util.FileHandler) error

AddFile add file and manage configs.

func (*Source) Cleanup

func (fSource *Source) Cleanup() error

Cleanup clear all configs.

func (*Source) Delete

func (fSource *Source) Delete(_ string) error

Delete no use.

func (*Source) GetConfigurationByKey

func (fSource *Source) GetConfigurationByKey(key string) (interface{}, error)

GetConfigurationByKey get one key value.

func (*Source) GetConfigurations

func (fSource *Source) GetConfigurations() (map[string]interface{}, error)

GetConfigurations get all configs.

func (*Source) GetPriority

func (fSource *Source) GetPriority() int

GetPriority get precedence.

func (*Source) GetSourceName

func (*Source) GetSourceName() string

GetSourceName get name of source.

func (*Source) Set

func (fSource *Source) Set(_ string, _ interface{}) error

Set no use.

func (*Source) SetPriority

func (fSource *Source) SetPriority(priority int)

SetPriority custom priority.

func (*Source) Watch

func (fSource *Source) Watch(callback source.EventHandler) error

Watch watch change event.

Jump to

Keyboard shortcuts

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