tokenstore

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2015 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package token stores the current sierra API access token in a safe container. Access is controlled by a sync.RWMutex

Index

Constants

View Source
const DefaultRefreshTime int = 10

The number of seconds a refresh will be scheduled for in the event of an error.

View Source
const MinimumTokenTTL int = 10

If the API returns a TTL less than this, error out.

View Source
const TokenRefreshBuffer int = 5

The number of seconds before a token would expire a new token is asked for. For example, if a token would expire in 50 seconds, and the TokenRefreshBuffer is 5 seconds, ask for a new token in 45 seconds.

View Source
const UninitialedTokenValue string = "uninitialized"

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenStore

type TokenStore struct {
	Refresh     chan struct{}
	Initialized chan struct{}
	// contains filtered or unexported fields
}

func NewTokenStore

func NewTokenStore() *TokenStore

func (*TokenStore) Get

func (t *TokenStore) Get() (string, error)

func (*TokenStore) Refresher

func (t *TokenStore) Refresher(tokenURL, clientKey, clientSecret string)

This function runs forever, waiting for a timeout or a message on the Refresh channel. It will exit if the Refresh channel is closed.

Jump to

Keyboard shortcuts

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