file

package
v6.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2017 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(base mb.BaseMetricSet) (mb.MetricSet, error)

Types

type Action

type Action uint8

Action is a description of the change that occurred.

const (
	Unknown Action = iota << 1
	AttributesModified
	Created
	Deleted
	Updated
	Moved
)

List of possible Actions.

func (Action) String

func (a Action) String() string

type Config

type Config struct {
	Paths            []string `config:"file.paths" validate:"required"`
	HashTypes        []string `config:"file.hash_types"`
	MaxFileSize      string   `config:"file.max_file_size"`
	MaxFileSizeBytes uint64   `config:",ignore"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Event

type Event struct {
	Timestamp  time.Time         // Time of event.
	Path       string            // The path associated with the event.
	TargetPath string            // Target path for symlinks.
	Action     string            // Action (like created, updated).
	Info       *Metadata         // File metadata (if the file exists).
	Hashes     map[string]string // File hashes.
	// contains filtered or unexported fields
}

Event describe the filesystem change and includes metadata about the file.

type EventReader

type EventReader interface {
	Start(done <-chan struct{}) (<-chan Event, error)
}

func NewEventReader

func NewEventReader(c Config) (EventReader, error)

NewEventReader creates a new EventReader backed by fsnotify.

type Metadata

type Metadata struct {
	Inode uint64
	UID   uint32
	GID   uint32
	SID   string
	Owner string
	Group string
	Mode  os.FileMode
	Size  int64
	ATime time.Time // Last access time.
	MTime time.Time // Last modification time.
	CTime time.Time // Last status change time.
	Type  string    // File type (dir, file, symlink).
}

Metadata contains file metadata.

func Stat

func Stat(path string) (*Metadata, error)

type MetricSet

type MetricSet struct {
	mb.BaseMetricSet
	// contains filtered or unexported fields
}

func (*MetricSet) Run

func (ms *MetricSet) Run(reporter mb.PushReporter)

Jump to

Keyboard shortcuts

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