Start working on a etcd backend

This commit is contained in:
Miek Gieben
2016-03-20 17:44:58 +00:00
parent 15518b5b6f
commit 57d45cbbd8
6 changed files with 495 additions and 0 deletions

34
middleware/etcd/etcd.go Normal file
View File

@@ -0,0 +1,34 @@
// Package etcd provides the etcd backend.
package etcd
import (
"github.com/skynetservices/skydns/singleflight"
etcd "github.com/coreos/etcd/client"
"golang.org/x/net/context"
)
type (
Etcd struct {
Ttl uint32
Priority uint16
Backend *Backend
}
)
type Backend struct {
client etcd.KeysAPI
ctx context.Context
config *Config
inflight *singleflight.Group
}
// NewBackend returns a new Backend.
func NewBackend(client etcd.KeysAPI, ctx context.Context, config *Config) *Backend {
return &Backend{
client: client,
ctx: ctx,
config: config,
inflight: &singleflight.Group{},
}
}