granitic: github.com/graniticio/granitic/instance Index | Files

package instance

import "github.com/graniticio/granitic/instance"

Package instance defines functionality for identifying and tuning an individual instance of a Granitic application.

It is anticipated that most Granitic applications will be deployed as part of a group behind a load-balancer or some other service discovery mechanism. In these circumstances, it is important that each individual instance can be named. So other services can identify it.

This package defines a type for storing an instance Id and an interface to be implemented by any component that needs to be aware of the Id of the current instance. An instance Id is specified when starting Granitic via a command line argument or an InitialSettings struct. See the documentation for the granitic pacakge for more detail.

This package also defines the data structure for the implicit System facility (which cannot be disabled, but can be configured). The System facility controls start up and shutdown behaviour as well as some memory management settings. See http://granitic.io/1.0/ref/system

Index

Package Files

instance.go

Constants

const FrameworkPrefix = "grnc"

The prefix for all Granitic owned components stored in the IoC container to namespace them apart from user defined components. It is strongly recommended (but not enforced) that user components do not use this prefix for their own names.

const InstanceIdComponent = FrameworkPrefix + "InstanceIdentifier"

The name of the component in the IoC container holding an instance Id.

func ExitError Uses

func ExitError()

Immediately exit the application with the return value 1 to signify a problem. Does not cleanly stop IoC components.

func ExitNormal Uses

func ExitNormal()

Immediately exit the application with the return value 0 to signify a normal exit. Does not cleanly stop IoC components.

type InstanceIdentifier Uses

type InstanceIdentifier struct {
    // A identifier for this instance application.
    Id string
}

A structure used to store the Id of a particular instance of a Granitic application. See the granitic package documentation for instructions on how to define the Id at application start time.

type InstanceIdentifierReceiver Uses

type InstanceIdentifierReceiver interface {
    // RegisterInstanceId is automatically called by the IoC container to inject the instance Id.
    RegisterInstanceId(*InstanceIdentifier)
}

Implemented by any component that needs to be aware of the Id of the current application instance.

type System Uses

type System struct {
    //The interval (in milliseconds) between checks of blocking components during the start->available lifecycle phase transition.
    BlockIntervalMS time.Duration

    //How many chances blocking components should be given to declare themselves ready before the application exits with an error.
    BlockRetries int

    //How many times a blocking component can declare it is blocked before a warning message is logged.
    BlockTriesBeforeWarn int

    //If the merged JSON configuration files should be discarded after startup is complete.
    FlushMergedConfig bool

    //If a garbage collection should be invoked after the container has finished populating and configuring the IoC container.
    GCAfterConfigure bool

    //If a garbage collection should be invoked after the container has called StartComponent on all components (but before AllowAccess).
    GCAfterStart bool

    //The interval (in milliseconds) between checks of stoppable components to see if they are ready to be stopped.
    StopIntervalMS time.Duration

    //How many chances stoppable components should be given to declare themselves ready to stop before the container stops them anyway.
    StopRetries int

    //How many times a stoppable component can declare it is not ready to stop before a warning message is logged
    StopTriesBeforeWarn int
}

A structure used by the implicit System facility to control start, stop and some memory management behaviour.

Package instance imports 2 packages (graph) and is imported by 15 packages. Updated 2018-03-04. Refresh now. Tools for package owners.