fsutils

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fsutils provides utility functions to manage mole related files and directories.

Index

Constants

View Source
const (
	InstancePidFile = "pid"
	InstanceLogFile = "mole.log"
)

Variables

This section is empty.

Functions

func CreateHomeDir

func CreateHomeDir() (string, error)

CreateHomeDir creates then returns the location where all mole related files are persisted, including alias configuration and log files.

func CreatePidFile

func CreatePidFile(id string) (string, error)

CreatePidFile creates a file, inside the directory allocated for instance, witht the instance process id.

func Dir

func Dir() (string, error)

Dir returns the location where all mole related files are persisted, including alias configuration and log files.

func GetLogFileLocation

func GetLogFileLocation(id string) (string, error)

GetLogFileLocation returns the file system location of the file where all log messages are saved for an specific detached application instance.

func GetPidFileLocation

func GetPidFileLocation(id string) (string, error)

GetPidFileLocation returns the file system location of the application instance in the file system.

func Pid

func Pid(id string) (int, error)

Pid returns the process id associated with the given alias or id.

func PidFileLocation

func PidFileLocation(id string) (string, error)

PidFileLocation returns the location of the pid file associated with a mole instance.

Only detached instances keep a pid file so, if an alias is given to this function, a path to a non-existent file will be returned.

func RpcAddress

func RpcAddress(id string) (string, error)

RpcAddress returns the network address of the rpc server for a given application instance id or alias.

Types

type InstanceDirInfo

type InstanceDirInfo struct {
	Id      string
	Dir     string
	PidFile string
}

func CreateInstanceDir

func CreateInstanceDir(appId string) (*InstanceDirInfo, error)

CreateInstanceDir creates and then returns the location where all files related to a specific mole instance are persisted. Along with the directory this function also created a pid file where the instance process id is stored.

func InstanceDir

func InstanceDir(id string) (*InstanceDirInfo, error)

InstanceDir returns the location where all files related to a specific mole instance are persisted.

Jump to

Keyboard shortcuts

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