dura

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright © 2022 Dane Nelson <apogeesystemsllc@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	YIELD   CallState = "Yield"
	RECURSE           = "Recurse"
	DONE              = "Done"
)

Variables

View Source
var (
	DefSleepSeconds = 5
)

Functions

func InitConfig

func InitConfig()

func InitDatabase

func InitDatabase()

func IsRepo

func IsRepo(path string) (isRepo bool, err error)

func IsValidDirectory

func IsValidDirectory(basePath string, childPath string, value WatchConfig) (valid bool, err error)

func StartPoller

func StartPoller()

Types

type CallState

type CallState string

type CaptureStatus

type CaptureStatus struct {
	DuraBranch string `json:"dura_branch"`
	CommitHash string `json:"commit_hash"`
	BaseHash   string `json:"base_hash"`
}

func Capture

func Capture(path string) (cs *CaptureStatus, err error)

func (*CaptureStatus) Display

func (cs *CaptureStatus) Display() (err error)

type CommitConfig

type CommitConfig struct {
	Author           *string `toml:"author"`
	Email            *string `toml:"email"`
	ExcludeGitConfig bool    `toml:"exclude_git_config"`
}

type Config

type Config struct {
	Dura         DuraConfig             `toml:"dura"`
	Commit       CommitConfig           `toml:"commit"`
	Repositories map[string]WatchConfig `toml:"repos" mapstructure:"repos"`
}

func GetConfig

func GetConfig() (config *Config)

func (*Config) CreateDir

func (c *Config) CreateDir(path string) (err error)

func (*Config) DefaultPath

func (c *Config) DefaultPath() (path string)

func (*Config) Empty

func (c *Config) Empty()

func (*Config) GetDuraConfigHome

func (c *Config) GetDuraConfigHome() (path string)

func (*Config) GitRepos

func (c *Config) GitRepos() (repos map[string]WatchConfig)

func (*Config) Load

func (c *Config) Load()

func (*Config) LoadFile

func (c *Config) LoadFile(filepath string) (err error)

func (*Config) Save

func (c *Config) Save() (err error)

func (*Config) SaveToPath

func (c *Config) SaveToPath(filename string) (err error)

func (*Config) SetUnwatch

func (c *Config) SetUnwatch(path string) (err error)

func (*Config) SetWatch

func (c *Config) SetWatch(path string, cfg WatchConfig) (err error)

type DuraConfig

type DuraConfig struct {
	SleepSeconds int `toml:"sleep_seconds" mapstructure:"sleep_seconds"`
}

type GitRepoIter

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

func NewGitRepoIter

func NewGitRepoIter(config Config) (iter *GitRepoIter)

func (*GitRepoIter) GetNext

func (iter *GitRepoIter) GetNext() (state CallState)

type Operation

type Operation struct {
	Snapshot OperationSnapshot `json:"snapshot"`
}

func (*Operation) ShouldLog

func (o *Operation) ShouldLog() bool

type OperationSnapshot

type OperationSnapshot struct {
	Repo    string         `json:"repo"`
	Op      *CaptureStatus `json:"op,omitempty"`
	Error   *string        `json:"error,omitempty"`
	Latency float32        `json:"latency"`
}

type RuntimeLock

type RuntimeLock struct {
	Pid *uint32 `json:"pid,omitempty" mapstructure:"pid,omitempty"`
}

func (*RuntimeLock) CreateDir

func (rl *RuntimeLock) CreateDir(path string) (err error)

func (*RuntimeLock) DefaultPath

func (rl *RuntimeLock) DefaultPath() (path string)

func (*RuntimeLock) Empty

func (rl *RuntimeLock) Empty()

func (*RuntimeLock) GetDuraCacheHome

func (rl *RuntimeLock) GetDuraCacheHome() (path string)

func (*RuntimeLock) Load

func (rl *RuntimeLock) Load() (err error)

func (*RuntimeLock) LoadFile

func (rl *RuntimeLock) LoadFile(filepath string) (err error)

func (*RuntimeLock) Save

func (rl *RuntimeLock) Save() (err error)

func (*RuntimeLock) SaveToPath

func (rl *RuntimeLock) SaveToPath(path string) (err error)

type WatchConfig

type WatchConfig struct {
	Include  []string `toml:"include" mapstructure:"include,omitempty"`
	Exclude  []string `toml:"exclude" mapstructure:"exclude,omitempty"`
	MaxDepth int      `toml:"max_depth" mapstructure:"max_depth,omitempty"`
}

func NewWatchConfig

func NewWatchConfig() (wc *WatchConfig)

Jump to

Keyboard shortcuts

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