election

package
v0.0.0-...-468f387 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2015 The Kubernetes Authors All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

ref: https://github.com/kubernetes/contrib/tree/master/election

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewElection

func NewElection(electionId, id, namespace string, ttl time.Duration, callback func(leader string), c clientset.Interface) (*leaderelection.LeaderElector, error)

NewElection creates an election. 'namespace'/'election' should be an existing Kubernetes Service 'id' is the id if this leader, should be unique.

func NewSimpleElection

func NewSimpleElection(electionId, id string, callback func(leader string), c clientset.Interface) (*leaderelection.LeaderElector, error)

NewSimpleElection creates an election, it defaults namespace to 'default' and ttl to 10s

func RunElection

func RunElection(e *leaderelection.LeaderElector)

RunElection runs an election given an leader elector. Doesn't return.

func SetTask

func SetTask(name string, t Task) error

Types

type Task

type Task interface {
	Run(string)
}

func GetTask

func GetTask(name string) (Task, error)

Jump to

Keyboard shortcuts

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