Documentation ¶
Index ¶
- Variables
- func AddFile(domainName, fileName, conf, note string) error
- func HasConfSuffix(file string) bool
- func Ignore(name string, isDir bool) bool
- type ConfManager
- func (c *ConfManager) Debug()
- func (c *ConfManager) Delete(event operate.Event) error
- func (c *ConfManager) FileList() []File
- func (c *ConfManager) GetFiles() *Files
- func (c *ConfManager) GetKeyData() map[string]map[string]KeyData
- func (c *ConfManager) GetRoot() string
- func (c *ConfManager) NewFile(event operate.Event) (*File, error)
- func (c *ConfManager) ParseSubscribe(rawSubscriptions []string) []string
- func (c *ConfManager) Subscribe(subscriptions []string) []model.StructData
- func (c *ConfManager) Update(event operate.Event) error
- type File
- func (f *File) Debug()
- func (f *File) GetInfo() os.FileInfo
- func (f *File) GetKeyData(section, key string) (model.ConfData, error)
- func (f *File) GetPath() string
- func (f *File) GetSection(section string) (Section, error)
- func (f *File) GetSections() []*Section
- func (f *File) KeyList() []model.ConfData
- type Files
- func (f *Files) Debug()
- func (f *Files) DelKey(file, section, key string) error
- func (f *Files) FileList() []File
- func (f *Files) GetExistPaths(fpaths []string) (files []string)
- func (f *Files) GetFile(fname string) (*File, error)
- func (f *Files) SectionKeyList(fname string, section string) map[string]model.ConfData
- func (f *Files) SetKey(file, section, key, value string) error
- func (f *Files) Walk(fn func(file *File) error) error
- type KeyData
- type Section
- type SubscribeType
- type Subscription
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ConfSuffix = []string{".conf"} DefaultSection = model.DefaultSection PathSeparator = model.PathSeparator )
Functions ¶
func HasConfSuffix ¶
Types ¶
type ConfManager ¶
ConfManager for managing configuration files and subscriptions
func InitConfManager ¶
func InitConfManager(domainName string, withLock bool) (*ConfManager, error)
func NewConfManager ¶
func NewConfManager(event operate.Event) (*ConfManager, error)
func NewConfManagerFromLocal ¶
func NewConfManagerFromLocal(root string, backupPath string) (*ConfManager, error)
NewConfManager return a new ConfManager given a path
func WrapConfManager ¶
func WrapConfManager(fs []File) (*ConfManager, error)
func (*ConfManager) Debug ¶
func (c *ConfManager) Debug()
func (*ConfManager) FileList ¶
func (c *ConfManager) FileList() []File
func (*ConfManager) GetFiles ¶
func (c *ConfManager) GetFiles() *Files
func (*ConfManager) GetKeyData ¶
func (c *ConfManager) GetKeyData() map[string]map[string]KeyData
func (*ConfManager) GetRoot ¶
func (c *ConfManager) GetRoot() string
func (*ConfManager) ParseSubscribe ¶
func (c *ConfManager) ParseSubscribe(rawSubscriptions []string) []string
ParseSubscribe handle subscription relationship and return real subscription file
Subscription file format
- subscribe section : /subscribe/file.conf/section
- subscribe file : /subscribe/file.conf
- subscribe directory : /subscribe/dir/ -> deprecated?
func (*ConfManager) Subscribe ¶
func (c *ConfManager) Subscribe(subscriptions []string) []model.StructData
Subscribe return struct data
type File ¶
type File struct { Name string `json:"name"` Sections []*Section `json:"sections"` // contains filtered or unexported fields }
func ParseFileConf ¶
func (*File) GetSections ¶
type Files ¶
type Files struct {
// contains filtered or unexported fields
}
func (*Files) GetExistPaths ¶
return file paths which exist in Files
func (*Files) SectionKeyList ¶
type SubscribeType ¶
type SubscribeType int
const ( SubscribeSection SubscribeType = 1 SubscribeFile SubscribeType = 2 SubscribeDir SubscribeType = 3 )
type Subscription ¶
type Subscription string
func (Subscription) File ¶
func (s Subscription) File() string
func (Subscription) InvolvedFilesPath ¶
func (s Subscription) InvolvedFilesPath() (files []string)
input = "/test.conf/section" output = "/test.conf" input = "/zy/test.conf/section" output = "/test.conf" "/zy/test.conf" input - "/center.conf" output = "/center.conf" input = "/zy/center.conf" output = "/center.conf" "/zy/center.conf" inherited path include current file and parents files
func (Subscription) Section ¶
func (s Subscription) Section() string
func (Subscription) Type ¶
func (s Subscription) Type() SubscribeType
Click to show internal directories.
Click to hide internal directories.