daemon

package
v0.1.23-oss Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ABFSDaemonEnvVar        = "ABFS_DAEMON"
	ABFSWSMountDaemonEnvVar = "ABFS_WS_MOUNT_DAEMON"
	ABFSSyncPipeEnvVar      = "ABFS_SYNC_PIPE_FD"
)
View Source
const (
	MountDetailsFileName = ".abfs.mount-details"
)

Variables

This section is empty.

Functions

func ForkDaemon

func ForkDaemon(cmd *exec.Cmd) (retErr error)

ForkDaemon runs the given command in daemon mode. It means it spawns it in a separate process group and captures its stdout and stderr and writes them to this process stdout and stderr. But as soon as the daemon process closes its stderr and stdout, this process will assume the daemon is successfully detached and this process exits. If the daemon finishes its execution (say because of some errors), before it detaches this process will exit with the same error. It also relays signals it receives to the daemon process.

func IsDaemon

func IsDaemon() bool

IsDaemon returns true if the current process is running as a daemon.

func NewCASFS

func NewCASFS(opt *CASFSMountOpts) *casfs

func WaitForFile

func WaitForFile(fileName string, timeout time.Duration) error

Wait for file at path to exist until specified timeout

func WaitForHash

func WaitForHash(dir string) error

Wait for hash attribute available on given directory

Types

type CASFSMountOpts

type CASFSMountOpts struct {
	Type            instance.CASFSType
	Info            filesystem.MountInfo
	MountPoint      string
	Socket          string
	MountDetails    *binding.MountDetails
	ManifestServer  string
	Cacheman        *client.Client
	Store           entities.CASStore
	MountedCallback func()
}

type Daemon

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

func SetupDaemon

func SetupDaemon(logFileName string) (d *Daemon, retErr error)

SetupDaemon sets up this process as a daemon, it will tee the stdout and stderr to the provided log file as well is the process original stdout and stderr. When Switch() is called it closes the original stdout and stderr and replaces them with log file only.

func (*Daemon) Close

func (d *Daemon) Close() error

Close closes the daemon pipelines and log files, ensuring all remaining buffered data is flushed.

func (*Daemon) Switch

func (d *Daemon) Switch()

Switch closes the original stdout and stderr and replaces them with the log file.

type SelfStoppingServer

type SelfStoppingServer struct {
	http.Server

	SocketPath string
	Done       chan struct{}
	// contains filtered or unexported fields
}

func (*SelfStoppingServer) Serve

func (s *SelfStoppingServer) Serve(l net.Listener) error

func (*SelfStoppingServer) Shutdown

func (s *SelfStoppingServer) Shutdown(ctx context.Context) error

func (*SelfStoppingServer) WatchSocket

func (s *SelfStoppingServer) WatchSocket(ctx context.Context) (retErr error)

type SnapshotService

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

func NewSnapshotService

func NewSnapshotService(casfs *casfs) *SnapshotService

func (*SnapshotService) AddGitRepo

func (c *SnapshotService) AddGitRepo(workDir string, repo binding.GitRepo)

func (*SnapshotService) GetGitRepo

func (c *SnapshotService) GetGitRepo(workDir string) (binding.GitRepo, bool)

func (*SnapshotService) GetMountDetails

func (c *SnapshotService) GetMountDetails() *binding.MountDetails

func (*SnapshotService) Restore

func (c *SnapshotService) Restore(ctx context.Context, snapshot binding.Snapshot) error

func (*SnapshotService) RestoreIndex

func (c *SnapshotService) RestoreIndex(ctx context.Context, indexSnapHash entities.Hash, gitRepo *gitRepo) error

func (*SnapshotService) SnapIndex

func (c *SnapshotService) SnapIndex(ctx context.Context, gitRepo *gitRepo) (entities.Hash, error)

func (*SnapshotService) Snapshot

func (c *SnapshotService) Snapshot(ctx context.Context) (binding.Snapshot, error)

Jump to

Keyboard shortcuts

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