Documentation ¶
Overview ¶
Package archivecache is a CoreDNS plugin that caches lookups and writes. If more than one request for the same resource is in flight, then they are queued to avoid redundant forwarding lookups
Index ¶
Constants ¶
const ( // Success is the class for caching positive caching. Success = "success" // Denial is the class defined for negative caching. Denial = "denial" )
Variables ¶
var ( CacheSize = promauto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: plugin.Namespace, Subsystem: "cache", Name: "size", Help: "The number of elements in the cache.", }, []string{"server", "type"}) CacheHits = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: plugin.Namespace, Subsystem: "cache", Name: "hits_total", Help: "The count of cache hits.", }, []string{"server", "type"}) CacheMisses = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: plugin.Namespace, Subsystem: "cache", Name: "misses_total", Help: "The count of cache misses.", }, []string{"server"}) )
Functions ¶
This section is empty.
Types ¶
type ArchivingCache ¶
type ArchivingCache struct { Next plugin.Handler singleflight.Group // contains filtered or unexported fields }
ArchivingCache is a CoreDNS plugin.
func NewArchivingCache ¶
func NewArchivingCache(cache *Cache, lw *LogWriterClient, cw *ContentWriterClient) *ArchivingCache
NewArchivingCache returns a new instance of ArchivingCache
func (*ArchivingCache) Name ¶
func (a *ArchivingCache) Name() string
Name implements the Handler interface.
func (*ArchivingCache) OnShutdown ¶
func (a *ArchivingCache) OnShutdown() (err error)
OnShutdown closes connections to content writer and log writer.
func (*ArchivingCache) OnStartup ¶
func (a *ArchivingCache) OnStartup() error
OnStartup connects to content writer and log writer.
func (*ArchivingCache) Ready ¶ added in v0.2.8
func (a *ArchivingCache) Ready() bool
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a wrapper around *bigcache.BigCache which takes care of marshalling and unmarshalling of dns.Msg.
type CacheEntry ¶
func (*CacheEntry) AddCollectionId ¶
func (ce *CacheEntry) AddCollectionId(collectionId string) []string
func (*CacheEntry) HasCollectionId ¶
func (ce *CacheEntry) HasCollectionId(collectionId string) bool
func (*CacheEntry) String ¶
func (ce *CacheEntry) String() string
type ContentWriterClient ¶ added in v0.2.8
type ContentWriterClient struct { *serviceconnections.Connection contentwriterV1.ContentWriterClient }
ContentWriterClient holds the connections for ContentWriterClient and Veidemann database
func NewContentWriterClient ¶ added in v0.2.8
func NewContentWriterClient(opts ...serviceconnections.ConnectionOption) *ContentWriterClient
NewContentWriterClient creates a new ContentWriterClient object
func (*ContentWriterClient) Connect ¶ added in v0.3.1
func (c *ContentWriterClient) Connect() error
Connect establishes connections
func (*ContentWriterClient) WriteRecord ¶ added in v0.3.1
func (c *ContentWriterClient) WriteRecord(payload []byte, fetchStart time.Time, requestedHost string, ipAddress string, executionId string, collectionId string) (*contentwriterV1.WriteReply, error)
WriteRecord writes a WARC record.
type LogWriterClient ¶ added in v0.3.1
type LogWriterClient struct { *serviceconnections.Connection *logservice.LogWriter }
func NewLogWriterClient ¶ added in v0.3.1
func NewLogWriterClient(opts ...serviceconnections.ConnectionOption) *LogWriterClient
func (*LogWriterClient) Connect ¶ added in v0.3.1
func (l *LogWriterClient) Connect() error
func (*LogWriterClient) WriteCrawlLog ¶ added in v0.3.1
func (l *LogWriterClient) WriteCrawlLog(record *contentwriterV1.WriteResponseMeta_RecordMeta, size int, requestedHost string, fetchStart time.Time, fetchDurationMs int64, ipAddress string, executionId string) error
WriteCrawlLog stores a crawl log of a dns request/response.
type Recorder ¶
type Recorder struct { dns.ResponseWriter Rcode int Msg *dns.Msg }
func NewRecorder ¶
func NewRecorder(w dns.ResponseWriter) *Recorder
NewRecorder makes and returns a new Recorder.