pacemaker

package module
v0.0.0-...-9755c00 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: LGPL-2.1 Imports: 5 Imported by: 1

README

Pacemaker

This library provides an API for connecting to and working with the Pacemaker cluster manager, specifically with the cluster configuration (the CIB), from the Go programming language.

It is not meant to be a complete API. The main use case is connecting to the CIB, subscribing to updates and reading the XML.

Note: This API is under heavy development.

Current features:

  • Connect and get CIB as an XML []byte block

Major missing features:

  • Decode CIB attributes and status section into a Go object structure

  • Encode status section as JSON

  • Decoding / encoding configuration section

  • Writing changes back to the CIB

  • Get CIB as JSON

  • Get CibObjects as JSON

  • Make changes

  • Create CibObjects

  • Get status of resources and nodes

  • History information

  • Meta information about agents etc.

Compilation

The compile-time dependencies are Pacemaker, glib 2.0 and libxml2.

On openSUSE and similar distributions, this will get you all the dependencies needed to compile:

zypper in libpacemaker-devel libxml2-devel glib2-devel

To run the tests, the pacemaker schema files need to be available as well. These are usually packaged separately, so to get these, you will need to install the pacemaker package as well:

zypper in pacemaker

Usage

See pacemaker_test.go for usage examples.

Documentation

Overview

The pacemaker package provides an API for reading the Pacemaker cluster configuration (CIB). Copyright (C) 2017 Kristoffer Gronlund <kgronlund@suse.com> See LICENSE for license.

The pacemaker package provides an API for reading the Pacemaker cluster configuration (CIB). Copyright (C) 2017 Kristoffer Gronlund <kgronlund@suse.com> See LICENSE for license.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForCommand

func ForCommand(config *CibOpenConfig)

func ForCommandNonBlocking

func ForCommandNonBlocking(config *CibOpenConfig)

func ForNoConnection

func ForNoConnection(config *CibOpenConfig)

func ForQuery

func ForQuery(config *CibOpenConfig)

func FromFile

func FromFile(file string) func(*CibOpenConfig)

func FromRemote

func FromRemote(server, user, passwd string, port int, encrypted bool) func(*CibOpenConfig)

func FromShadow

func FromShadow(shadow string) func(*CibOpenConfig)

func GetShadowFile

func GetShadowFile(name string) string

func IsTrue

func IsTrue(bstr string) bool

func Mainloop

func Mainloop()

Types

type Cib

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

Root entity representing the CIB. Can be populated with CIB data if the Decode method is used.

func OpenCib

func OpenCib(options ...func(*CibOpenConfig)) (*Cib, error)

func (*Cib) Close

func (cib *Cib) Close() error

func (*Cib) Query

func (cib *Cib) Query() (*CibDocument, error)

func (*Cib) QueryNoChildren

func (cib *Cib) QueryNoChildren() (*CibDocument, error)

func (*Cib) QueryXPath

func (cib *Cib) QueryXPath(xpath string) (*CibDocument, error)

func (*Cib) QueryXPathNoChildren

func (cib *Cib) QueryXPathNoChildren(xpath string) (*CibDocument, error)

func (*Cib) Subscribe

func (cib *Cib) Subscribe(callback CibEventFunc) (uint, error)

func (*Cib) Subscribers

func (cib *Cib) Subscribers() map[int]CibEventFunc

func (*Cib) Version

func (cib *Cib) Version() (*CibVersion, error)

type CibConnection

type CibConnection int

When connecting to Pacemaker, we have to declare which type of connection to use. Since the API is read-only at the moment, it only really makes sense to pass Query to functions that take a CibConnection parameter.

type CibDocument

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

func (*CibDocument) Close

func (doc *CibDocument) Close()

func (*CibDocument) ToString

func (doc *CibDocument) ToString() string

func (*CibDocument) Version

func (doc *CibDocument) Version() *CibVersion

type CibError

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

Error type returned by the functions in this package.

func (*CibError) Error

func (e *CibError) Error() string

type CibEvent

type CibEvent int
const (
	UpdateEvent  CibEvent = 0
	DestroyEvent CibEvent = 1
)

func (CibEvent) String

func (i CibEvent) String() string

type CibEventFunc

type CibEventFunc func(event CibEvent, doc *CibDocument)

type CibOpenConfig

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

type CibVersion

type CibVersion struct {
	AdminEpoch int32
	Epoch      int32
	NumUpdates int32
}

func (*CibVersion) String

func (ver *CibVersion) String() string

type Element

type Element struct {
	Type     string
	Id       string
	Attr     map[string]string
	Elements []*Element
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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