store

package
v0.0.0-...-07f90b3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_ANSWER_TIME_TO_LIVE time.Duration = 5 * time.Minute
View Source
var DEFAULT_GROUP_CACHE_TIME_TO_LIVE time.Duration = 5 * time.Minute

Functions

This section is empty.

Types

type AnswersCacheStore

type AnswersCacheStore interface {
	Get(key string) ([]dnsmessage.Resource, rErrrors.Error)
	Set(key string, log ...dnsmessage.Resource) rErrrors.Error
	Remove(key string) rErrrors.Error
	Trim() rErrrors.Error
}

func NewAnswersCacheStore

func NewAnswersCacheStore() AnswersCacheStore

type AnswersCacheStoreData

type AnswersCacheStoreData struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*AnswersCacheStoreData) Get

func (*AnswersCacheStoreData) Remove

func (b *AnswersCacheStoreData) Remove(key string) rErrrors.Error

func (*AnswersCacheStoreData) Set

func (*AnswersCacheStoreData) Trim

type DNSRecord

type DNSRecord struct {
	NodeName string
	Type     string
	Addr     net.IP
	Data     string
	Resource dnsmessage.Resource
	TTL      uint32
	Created  time.Time
}

type GroupStore

type GroupStore interface {
	// Gets all keys
	Keys() []string
	// Gets Records for a key
	Get(key string) ([]DNSRecord, rErrrors.Error)
	// Sets New Record for a key
	Set(key string, record DNSRecord) rErrrors.Error
	// Remove Records for a key
	Remove(key string) rErrrors.Error
	// Retrieve group name
	GetGroup() string
	// Retrieve references domains
	GetDomains() []string
	// Retrieve store name forwarders
	GetForwarders() []net.UDPAddr
	//Remove all records in the store
	ClearData()
}

This represent a single zone key store One server key can match more records ...

func NewGroupStore

func NewGroupStore(groupName string, domains []string, forwarders []net.UDPAddr) GroupStore

Generate New _zone Records Store

type GroupStoreData

type GroupStoreData struct {
	sync.RWMutex

	GroupName  string
	Domains    []string
	Forwarders []net.UDPAddr
	// contains filtered or unexported fields
}

func (*GroupStoreData) ClearData

func (b *GroupStoreData) ClearData()

func (*GroupStoreData) FromPersistentData

func (b *GroupStoreData) FromPersistentData(persistent GroupStorePersistent)

func (*GroupStoreData) Get

func (b *GroupStoreData) Get(key string) ([]DNSRecord, rErrrors.Error)

func (*GroupStoreData) GetDomains

func (b *GroupStoreData) GetDomains() []string

func (*GroupStoreData) GetForwarders

func (b *GroupStoreData) GetForwarders() []net.UDPAddr

func (*GroupStoreData) GetGroup

func (b *GroupStoreData) GetGroup() string

func (*GroupStoreData) Keys

func (b *GroupStoreData) Keys() []string

func (*GroupStoreData) PersistentData

func (b *GroupStoreData) PersistentData() GroupStorePersistent

func (*GroupStoreData) Remove

func (b *GroupStoreData) Remove(key string) rErrrors.Error

func (*GroupStoreData) Replace

func (b *GroupStoreData) Replace(key string, records []DNSRecord) rErrrors.Error

func (*GroupStoreData) Set

func (b *GroupStoreData) Set(key string, record DNSRecord) rErrrors.Error

type GroupStoreMeta

type GroupStoreMeta struct {
	Store   GroupStore
	Created time.Time
	TTL     time.Duration
}

func (GroupStoreMeta) IsValid

func (gsm GroupStoreMeta) IsValid() bool

type GroupStorePersistent

type GroupStorePersistent struct {
	Store      map[string][]DNSRecord
	GroupName  string
	Domains    []string
	Forwarders []net.UDPAddr
}

type GroupsStore

type GroupsStore interface {
	// Retrieves a _zone storage by zone key
	Get(key string) (GroupStore, rErrrors.Error)
	// Retrieves a group storage and zone id by zone name
	GetByGroup(zone string) (GroupStore, string, rErrrors.Error)
	// Retrieves a group storage list matching on a given domain
	GetFirstByDomain(domain string) (GroupStore, string, rErrrors.Error)
	// Replaces a _zone storage by key
	Set(key string, addr GroupStore) rErrrors.Error
	// Remove entire sone
	Remove(key string) rErrrors.Error
	// Get Zone Keys
	Keys() []string
	// Removes expired groups
	Trim() error
}

Defines the behaviour od a multi-zone tenant storage

func NewGroupsStore

func NewGroupsStore() GroupsStore

type GroupsStoreData

type GroupsStoreData struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*GroupsStoreData) Get

func (*GroupsStoreData) GetAllByDomain

func (b *GroupsStoreData) GetAllByDomain(domain string) ([]GroupStore, rErrrors.Error)

func (*GroupsStoreData) GetByGroup

func (b *GroupsStoreData) GetByGroup(group string) (GroupStore, string, rErrrors.Error)

func (*GroupsStoreData) GetFirstByDomain

func (b *GroupsStoreData) GetFirstByDomain(domain string) (GroupStore, string, rErrrors.Error)

func (*GroupsStoreData) Keys

func (b *GroupsStoreData) Keys() []string

func (*GroupsStoreData) Remove

func (b *GroupsStoreData) Remove(key string) rErrrors.Error

func (*GroupsStoreData) Set

func (b *GroupsStoreData) Set(key string, store GroupStore) rErrrors.Error

func (*GroupsStoreData) Trim

func (b *GroupsStoreData) Trim() error

type RequestsCacheStore

type RequestsCacheStore interface {
	Get(key string) ([]net.UDPAddr, rErrrors.Error)
	Set(key string, log net.UDPAddr) rErrrors.Error
	Remove(key string) rErrrors.Error
}

func NewRequestsCacheStore

func NewRequestsCacheStore() RequestsCacheStore

type RequestsCacheStoreData

type RequestsCacheStoreData struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*RequestsCacheStoreData) Get

func (*RequestsCacheStoreData) Remove

func (*RequestsCacheStoreData) Set

Jump to

Keyboard shortcuts

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