store

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: AGPL-3.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCacheMiss = errors.New("cache miss")
	ErrNotFound  = errors.New("not found")
	ErrExpired   = errors.New("expired")
	ErrInternal  = errors.New("internal error")
)

Errors

View Source
var (
	ErrNotImplemented = errors.New("not implemented")
	ErrNotSupported   = errors.New("not supported")
)

Errors

Functions

func SearchLDAP added in v0.1.0

func SearchLDAP(cn *ldap.Conn, basedn string, filter string, attributes ...string) (*ldap.SearchResult, error)

SearchLDAP wraps constructing and running a boilerplate ldap search

Types

type Cache

type Cache interface {
	Put(key string, value interface{}) error
	PutUntil(time time.Time, key string, value interface{}) error
	Get(key string) (interface{}, error)
	Delete(key string) error
	Keys() ([]string, error)
}

Cache describes very simple TTL cache interface.

func NewBoltDBCache

func NewBoltDBCache(path string, bucket string) (Cache, error)

NewBoltDBCache implementes Cache with a BoltDB back-end;

func NewLDAPCache added in v0.1.0

func NewLDAPCache(config *LDAPConfig, class string, recordFn func(string, string) (interface{}, func(*ldap.Conn) error)) Cache

NewLDAPCache returns a cache suitable for interacting with LDAP

func NewMemoryCache

func NewMemoryCache() Cache

NewMemoryCache implementes Cache with an in-memory store

type LDAPConfig added in v0.1.0

type LDAPConfig struct {
	Host     string
	Port     int
	UseTLS   bool
	Username string
	Password string
	BaseDN   string
}

LDAPConfig describes connection details to an LDAP server

func (*LDAPConfig) Connect added in v0.1.0

func (c *LDAPConfig) Connect() (*ldap.Conn, error)

Connect is a helper function for connecting to LDAP

Jump to

Keyboard shortcuts

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