watchman

package module
v0.0.0-...-c2ac71c Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: MIT Imports: 11 Imported by: 0

README

go bindings for watchman.

Commands

Command Implemented Notes
clock
find
flush-subscriptions
get-config
get-sockname
list-capabilities
log
log-level
query
shutdown-server
since
state-enter
state-leave
subscribe
trigger
trigger-del
trigger-list
unsubscribe
version
watch
watch-del
watch-del-all
watch-list
watch-project

Documentation

Index

Constants

View Source
const (
	LogLevelDebug = "debug"
	LogLevelError = "error"
	LogLevelOff   = "off"
)

the supported log levels

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Sockname string
	// contains filtered or unexported fields
}

Client is a watchman client

func (*Client) Clock

func (c *Client) Clock(path string) (*Clock, error)

Clock returns the current clock value for a watched root. https://facebook.github.io/watchman/docs/cmd/clock.html

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the watchman server

func (*Client) Find

func (c *Client) Find(path string, patterns ...string) (*Find, error)

Find finds all files that match the optional list of patterns under the specified dir. If no patterns were specified, all files are returned. https://facebook.github.io/watchman/docs/cmd/find.html

func (*Client) LogLevel

func (c *Client) LogLevel(level string) (*LogLevel, error)

LogLevel changes the log level of the connection https://facebook.github.io/watchman/docs/cmd/log-level.html

func (*Client) Receive

func (c *Client) Receive(ch chan<- interface{}) (func(), error)

Receive listens for unilateral messages from the server on ch.

func (*Client) Send

func (c *Client) Send(dest interface{}, args ...interface{}) error

Send makes a client call

func (*Client) Subscribe

func (c *Client) Subscribe(path, name string, expr map[string]interface{}, ch chan<- *SubscribeEvent) (*Subscribe, func(), error)

Subscribe subscribes to changes against a specified root and requests that they be sent to the client via its connection. The updates will continue to be sent while the connection is open. If the connection is closed, the subscription is implicitly removed https://facebook.github.io/watchman/docs/cmd/subscribe.html todo(isao) - add expression type?

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(path, name string) (*Unsubscribe, error)

Unsubscribe cancels a named subscription against the specified root. The server side will no longer generate subscription packets for the specified subscription. https://facebook.github.io/watchman/docs/cmd/unsubscribe.html

func (*Client) Version

func (c *Client) Version() (*Version, error)

Version will tell you the version and build information for the currently running watchman service https://facebook.github.io/watchman/docs/cmd/version.html

func (*Client) Watch

func (c *Client) Watch(path string) (*Watch, error)

Watch requests that the specified dir is watched for changes https://facebook.github.io/watchman/docs/cmd/watch.html

func (*Client) WatchDel

func (c *Client) WatchDel(path string) (*WatchDel, error)

WatchDel removes a watch and any associated triggers

func (*Client) WatchDelAll

func (c *Client) WatchDelAll(path string) (*WatchDelAll, error)

WatchDelAll removes all watches and associated triggers https://facebook.github.io/watchman/docs/cmd/watch-del-all.html

func (*Client) WatchList

func (c *Client) WatchList() (*WatchList, error)

WatchList returns a list of watched dirs https://facebook.github.io/watchman/docs/cmd/watch-list.html

func (*Client) WatchProject

func (c *Client) WatchProject(path string) (*WatchProject, error)

WatchProject requests that the project containing the requested dir is watched for changes https://facebook.github.io/watchman/docs/cmd/watch-project.html

type Clock

type Clock struct {
	Clock string `bser:"clock"`
}

Clock is the return object of the Clock call

type Error

type Error string

Error is a Watchman API error

func (Error) Error

func (e Error) Error() string

type File

type File struct {
	Cclock string `bser:"cclock"`
	Ctime  int    `bser:"ctime"`
	Dev    int    `bser:"dev"`
	Exists bool   `bser:"exists"`
	Gid    int    `bser:"gid"`
	Ino    int    `bser:"ino"`
	Mode   int    `bser:"mode"`
	Mtime  int    `bser:"mtime"`
	Name   string `bser:"name"`
	New    bool   `bser:"new"`
	Nlink  int    `bser:"nlink"`
	Oclock string `bser:"oclock"`
	Size   int    `bser:"size"`
	UID    int    `bser:"uid"`
}

File represents a file on the filesystem

type Find

type Find struct {
	Clock string `bser:"clock"`
	Files []File `bser:"files"`
}

Find is the return object of the Find call

type LogEvent

type LogEvent struct {
	Level string `bser:"level"`
	Log   string `bser:"log"`
}

LogEvent is the event sent for log messages

type LogLevel

type LogLevel struct {
	LogLevel string `bser:"log_level"`
}

LogLevel is the return object of SetLogLevel

type Subscribe

type Subscribe struct {
	Clock     string `bser:"clock"`
	Subscribe string `bser:"subscribe"`
}

Subscribe is the return object of the Subscribe call

type SubscribeEvent

type SubscribeEvent struct {
	Clock           string          `bser:"clock"`
	Files           []SubscribeFile `bser:"files"`
	IsFreshInstance bool            `bser:"is_fresh_instance"`
	Root            string          `bser:"root"`
	Since           string          `bser:"since"`
	Subscription    string          `bser:"subscription"`
}

SubscribeEvent is the unilateral message that indicates an fs event occurred for the specified subscription

type SubscribeFile

type SubscribeFile struct {
	Mode   int    `bser:"mode"`
	New    bool   `bser:"new"`
	Size   int    `bser:"size"`
	Exists bool   `bser:"exists"`
	Name   string `bser:"name"`
}

SubscribeFile is a representation of the file that was somehow changed

type Unsubscribe

type Unsubscribe struct {
	Deleted     bool   `bser:"deleted"`
	Unsubscribe string `bser:"unsubscribe"`
}

Unsubscribe is the return object of the Subscribe call

type Version

type Version struct {
	Version string
}

Version is the return object of the Version call

type Watch

type Watch struct {
	Watch   string
	Watcher string
}

Watch is the return object of the Watch call

type WatchDel

type WatchDel struct {
	Root     string `bser:"root"`
	WatchDel bool   `bser:"watch-del"`
}

WatchDel is the return object of the WatchDel call

type WatchDelAll

type WatchDelAll struct {
	Roots []string `bser:"roots"`
}

WatchDelAll is the return object of the WatchDelAll call

type WatchList

type WatchList struct {
	Roots []string
}

WatchList is the return object of the WatchList call

type WatchProject

type WatchProject struct {
	Version string
	Watch   string
	Watcher string
}

WatchProject is the return object of the WatchProject call

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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