Documentation
¶
Overview ¶
Config
PidPortFile
Index ¶
- Variables
- func AddConfigFlag(cmd *cobra.Command, accessor string)
- func ClearPidPort() error
- func CreateConfigFile(name string) (string, error)
- func ErrorToWampResult(err error) nxclient.InvokeResult
- func GetDefaultNodeFolder() string
- func InitConfig(path string)
- func PrintWithStacktrace(err error)
- func ReadPidPort() (int, int, error)
- func RemoveConfigFile(name string) error
- func StackError(err error, args ...interface{}) error
- func WritePidPort() error
- type Cid
- type ConfigEntry
- type ConfigHandler
- type DecotableFunc
- type Encotable
- type Error
- func (self *Error) AddToStack(val string)
- func (self *Error) Arguments() []interface{}
- func (self *Error) Class() OCPErrorClass
- func (self *Error) Error() string
- func (self *Error) ErrorType() string
- func (self *Error) ErrorWithStacktrace() string
- func (self *Error) Message() string
- func (self *Error) Origin() string
- func (self *Error) Reason() string
- func (self *Error) Source() string
- func (self *Error) Stack() []string
- type OCPError
- type OCPErrorClass
Constants ¶
This section is empty.
Variables ¶
var Application = OCPErrorClass("application") //Problems that occure based on current application state
var CidUndef = Cid{cid.Undef}
var Connection = OCPErrorClass("connection") //Problems with any connection to the outside world
var Decoder = newDecoder()
var Internal = OCPErrorClass("internal") //Fatal internal errors
var Type = OCPErrorClass("type") //Type errors
var User = OCPErrorClass("user") //Problems that occure based on user input
Functions ¶
func AddConfigFlag ¶
Adds a flag to a command based on a config entry. This uses the long and short names as defined in the config, as well as the default vaule. The accessor string is the standart viper access string.
func ClearPidPort ¶
func ClearPidPort() error
func CreateConfigFile ¶
func ErrorToWampResult ¶
func ErrorToWampResult(err error) nxclient.InvokeResult
func GetDefaultNodeFolder ¶
func GetDefaultNodeFolder() string
func InitConfig ¶
func InitConfig(path string)
Default init of config stuff: - There is always a config file, even if node is not initialized - If not existing it must be created - Default values are setup - Setup the subcommands for the main config command
func PrintWithStacktrace ¶
func PrintWithStacktrace(err error)
func ReadPidPort ¶
Read the pid from the configured file. It is an error if the pidfile hasn't been configured.
func RemoveConfigFile ¶
func StackError ¶
func WritePidPort ¶
func WritePidPort() error
Write the pidfile based on the flag. It is an error if the pidfile hasn't been configured.
Types ¶
type Cid ¶
func FromP2PCid ¶
func (Cid) MarshalBinary ¶
func (*Cid) UnmarshalBinary ¶
It implements the encoding.BinaryUnmarshaler interface. Needed as we want to be able to use CidUndef in gob
type ConfigEntry ¶
func GetConfigEntry ¶
func GetConfigEntry(keys ...string) (ConfigEntry, error)
func (ConfigEntry) IsIntSlice ¶
func (self ConfigEntry) IsIntSlice() bool
func (ConfigEntry) IsSlice ¶
func (self ConfigEntry) IsSlice() bool
func (ConfigEntry) IsStringSlice ¶
func (self ConfigEntry) IsStringSlice() bool
func (ConfigEntry) ValueFromString ¶
func (self ConfigEntry) ValueFromString(value string) (interface{}, error)
type ConfigHandler ¶
type ConfigHandler struct {
// contains filtered or unexported fields
}
WAMP API for conf read/write
func NewConfigAPI ¶
func NewConfigAPI(client *nxclient.Client) *ConfigHandler
func (*ConfigHandler) Close ¶
func (self *ConfigHandler) Close()
type DecotableFunc ¶
type Encotable ¶
type Encotable interface {
Encode() string
}
A interface for types that could be decoded into string, and hence be used for marshalling The output of the Encode function has to has a defined prefix: ocp_**_ where ** is a arbitrary type specific string. This type identifier is used by the Decoder to recognize the type. "_" is not allowed in the data string
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func NewError ¶
func NewError(class OCPErrorClass, source, reason, message string, args ...interface{}) *Error
Creates a new Error from the following informations: * - class: one of the predefined OCPErrorClass types * - source: custom identifier specifying the source of the error (e.g. datastore, host etc.) * - reason: custom identifier specifying the general reason. This is not intended as description, but a kind of grouping for reasons, e.g. "key_not_existant" * - message: detailed information of what has gone wrong * - args: Arguments further detail the error with runtime information provided in log style doubles, e.g. "MyNAme", name, "MyId", id
func (*Error) AddToStack ¶
func (*Error) Class ¶
func (self *Error) Class() OCPErrorClass
func (*Error) ErrorWithStacktrace ¶
Prints the error in the form of: ErrorType origin: message (Arguments) Stacktraces...
type OCPError ¶
type OCPError interface {
error
Class() OCPErrorClass
Source() string
Reason() string
Message() string
Origin() string
Arguments() []interface{}
Stack() []string
ErrorType() string
ErrorWithStacktrace() string
AddToStack(string)
}
the default error used for all OCP related errors
func WampRPCErrorToError ¶
type OCPErrorClass ¶
type OCPErrorClass string