core

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accept

func Accept[T ~string](s T, allowed ...T) bool

func Deny

func Deny[T ~string](s T, denied ...T) bool

func First

func First[T any](ts []*T, walk func(*T) []*T, pred func(*T) bool) *T

func Focused

func Focused(ws []ipc.Workspace) *ipc.Workspace

func NewPrefixLogger

func NewPrefixLogger(prefix string, logch LogChannel) *prefixLogger

Types

type BasicBlock

type BasicBlock struct {
	Client   Client
	Opts     *Options
	LogLevel LogLevel
	Log      Logger
}

type BlockFactory

type BlockFactory func() BlockInitializer

type BlockInitializer

type BlockInitializer interface {
	Init(client Client, sub Sub, opts *Options, log Logger, args ...string) error
	SetLogLevel(level LogLevel)
}

type BlockRegistry

type BlockRegistry map[string]BlockFactory
var Blocks BlockRegistry

func (BlockRegistry) Register

func (r BlockRegistry) Register(key string, factory BlockFactory) error

type BlockRunnerCloser

type BlockRunnerCloser interface {
	BlockInitializer
	Runner
	io.Closer
}

type Client

type Client interface {
	Command(cmd string) ([]ipc.Command, error)
	CommandRaw(cmd string) (string, error)
	Workspaces() ([]ipc.Workspace, error)
	WorkspacesRaw() (string, error)
	Tree() (*ipc.Node, error)
	TreeRaw() (string, error)
	Version() (*ipc.Version, error)
	VersionRaw() (string, error)
}

Client exports a limited set of methods for use by core.Block instances.

type DuplicateKeyError

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

func (*DuplicateKeyError) Error

func (e *DuplicateKeyError) Error() string

type LogChannel

type LogChannel chan<- LogMessage

func (LogChannel) Send

func (lc LogChannel) Send(level LogLevel, prefix string, msg string)

func (LogChannel) Sendf

func (lc LogChannel) Sendf(level LogLevel, prefix string, format string, args ...interface{})

type LogLevel

type LogLevel int8
const (
	DefaultLog LogLevel = 0
	InfoLog    LogLevel = 10
	DebugLog   LogLevel = 30
)

func (LogLevel) Debug

func (l LogLevel) Debug() bool

func (LogLevel) Default

func (l LogLevel) Default() bool

func (LogLevel) Info

func (l LogLevel) Info() bool

func (*LogLevel) Set

func (l *LogLevel) Set(s string) error

func (LogLevel) String

func (i LogLevel) String() string

type LogMessage

type LogMessage interface {
	String() string
	Level() LogLevel
}

type Logger

type Logger interface {
	Default(msg string)
	Defaultf(format string, args ...any)
	Info(msg string)
	Infof(format string, args ...any)
	Debug(msg string)
	Debugf(format string, args ...any)
}

type Options

type Options struct {
	Server ServerControlChannel
}

Options are shared options for use by core.Block instances. Use the Log channel to send log data back to the daemon.

type PrefixLogMessage

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

func (PrefixLogMessage) Level

func (lm PrefixLogMessage) Level() LogLevel

func (PrefixLogMessage) String

func (lm PrefixLogMessage) String() string

type Receiver

type Receiver interface {
	Receive(args []string) error
}

type Runner

type Runner interface {
	Run()
}

type ServerControlChannel

type ServerControlChannel chan<- ServerControlRequest

func (ServerControlChannel) RequestExit

func (scc ServerControlChannel) RequestExit()

func (ServerControlChannel) RequestReload

func (scc ServerControlChannel) RequestReload()

type ServerControlRequest

type ServerControlRequest int8
const (
	ReloadRequest ServerControlRequest = 0
	ExitRequest   ServerControlRequest = 1
)

type Sub

type Sub interface {
	WorkspaceChanges(func(ipc.WorkspaceChange)) (ipc.Cookie, error)
	WindowChanges(func(ipc.WindowChange)) (ipc.Cookie, error)
	BindingChanges(func(ipc.BindingChange)) (ipc.Cookie, error)
	ModeChanges(func(ipc.ModeChange)) (ipc.Cookie, error)
	ShutdownChanges(func(ipc.ShutdownChange)) (ipc.Cookie, error)
	Ticks(func(ipc.Tick)) (ipc.Cookie, error)
}

Sub exports a limited set of methods for use by core.Block instances.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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