...

Package diarkis

import "github.com/Diarkis/diarkis"
Overview
Index
Subdirectories

Overview ▾

Constants

const (
    // Version This is the version of diarkis
    Version = "0.9.28"
    // Author This is the author of diarkis
    Author = "Diarkis"
)

func GetCPUNumUsed

func GetCPUNumUsed() int

GetCPUNumUsed returns the number of CPU the process is using

func GetDiarkisPath

func GetDiarkisPath() string

GetDiarkisPath Returns the absolute path to diarkis

func GetVer

func GetVer() string

GetVer Returns the version of diarkis

func IsRunning

func IsRunning() bool

IsRunning returns true if diarkis process is running

func IsStarted

func IsStarted() bool

IsStarted returns true after OnStarted callbacks have been executed.

If true, Diarkis server process has finished all preparation operations and ready.

func IsTerminating

func IsTerminating() bool

IsTerminating returns true when the process is shutting down

func OnReady

func OnReady(task func(func(error)))

OnReady Registers a callback on diarkis ready (This will be invoked before OnStarted while the server is being started)

This event is raised after all OnStart tasks have completed their operations.

task - Callback to be invoked while Diarkis server process is being started.
       Must call next function at the end of the callback to make sure the process moves on to the next task.

func OnReadyLast

func OnReadyLast(lastTask func(func()))

OnReadyLast it is used by ONLY mesh internally

func OnSIGHUP

func OnSIGHUP(task func())

OnSIGHUP Registers a callback on SIGHUP signal

task - Callback to be invoked when the server receives the signal.

func OnSIGUSR1

func OnSIGUSR1(taskName string, task func()) bool

OnSIGUSR1 Registers a callback on SIGUSR1 signal. When the signal is captured, Diarkis will look for a specific file in /tmp/ directory.

The file in /tmp/ must be named as DIARKIS_SIGUSR1 and the file must contain a task name.

The task name is then read by Diarkis and if a task callback with the task name exists, it is then invoked.

taskName - Associated with the callback.
task     - Callback to be invoked when the server receives the signal.

func OnSIGUSR2

func OnSIGUSR2(taskName string, task func()) bool

OnSIGUSR2 Registers a callback on SIGUSR1 signal

When the signal is captured, Diarkis will look for a specific file in /tmp/ directory.

The file in /tmp/ must be named as DIARKIS_SIGUSR2 and the file must contain a task name.

The task name is then read by Diarkis and if a task callback with the task name exists, it is then invoked.

taskName - Associated with the callback.
task     - Callback to be invoked when the server receives the signal.

func OnStart

func OnStart(task func())

OnStart Registers a callback on diarkis process start.

task - Callback to be invoked when Diarkis server is started.

func OnStarted

func OnStarted(callback func())

OnStarted registers a callback to be invoked when diarkis server process completed all starting operations.

This event is raised after all OnReady tasks have completed their operations.

callback - Callback to be invoked when Diarkis server finishes all pre-start operations and ready.

func OnTerminate

func OnTerminate(task func(func(error)))

OnTerminate Registers a callback on diarkis process terminate

task - Callback to be invoked when the server receives SIGTERM.
       next function must be called at the end of the callback to move on to the next callbacks.

func Run

func Run()

Run Starts diarkis process and stops when all operations are done

func Start

func Start()

Start Starts diarkis process and stays running until it is instructed to stop.

This function will block until the process is terminated. It will raise OnReady event.

func Stop

func Stop()

Stop Stops diarkis process exit code is 0

func StopWithError

func StopWithError(err error)

StopWithError Stops diarkis process with an error exit code is 1

Subdirectories

Name Synopsis
..
config
datacapsule Package datacapsule ▷
debug Package debug ▷
dm Package dm ▷
encryption
error
eventemitter
field Package field ▷
group Package group ▷
groupSupport
log Package log ▷
lib
colorize
msg
std
mars
matching Package matching ▷
members
mesh Package mesh ▷
lib
announcer
msg
packet
reliable
udp
metrics Package metrics ▷
mutex
net
p2p
packet
process
progressbar
room Package room ▷
mapping Package mapping ▷
roomSupport
scripts
server Package server ▷
connector
http Package http ▷
tcp
udp
ws
session Package Session ▷
smap Package smap ▷
synchronizer
test
bot
lib
notifier
tester Package tester ▷
tests
cloud_services
azure
datacapsule
field
http
mapping
mars
matching
members
mesh
packet
servers
smap
tcp
timed
udp
user
util
vault
timed
user
util Package util ▷
uuid
v4
vault
wsEncryption