dnsmdb

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package dnsmdb implements dnsutil.Archive using mongodb backend.

This package is a work in progress and makes no API stability promises.

Index

Constants

View Source
const (
	DefaultDBName         = "luidsdb"
	DefaultResolvBulkSize = 1024
	DefaultSyncSeconds    = 5
)

Default values.

View Source
const (
	ResolvColName = "resolvs"
)

Collection names.

View Source
const ServiceClass = "dnsmdb"

ServiceClass registered.

Variables

This section is empty.

Functions

func Builder

func Builder() archive.BuildServiceFn

Builder returns a builder function.

Types

type Archiver

type Archiver struct {
	// contains filtered or unexported fields
}

Archiver implements dns archive backend using a mongo database.

func New

func New(id string, session *mgo.Session, db string, opt ...Option) *Archiver

New creates a new storage.

func (*Archiver) Class

func (a *Archiver) Class() string

Class implements archive.Service interface.

func (*Archiver) ID

func (a *Archiver) ID() string

ID implements archive.Service interface.

func (*Archiver) Implements

func (a *Archiver) Implements() []archive.API

Implements implements archive.Service interface.

func (*Archiver) Ping

func (a *Archiver) Ping() error

Ping tests the connection with the storage.

func (*Archiver) SaveResolv

func (a *Archiver) SaveResolv(ctx context.Context, r *dnsutil.ResolvData) (string, error)

SaveResolv implements dnsutil.Archiver interface.

func (*Archiver) Shutdown

func (a *Archiver) Shutdown()

Shutdown closes the conection.

func (*Archiver) Start

func (a *Archiver) Start() error

Start the archiver.

type Option

type Option func(*options)

Option encapsules options.

func CloseSession

func CloseSession(b bool) Option

CloseSession option allows close mongo session on shutdown.

func SetLogger

func SetLogger(l yalogi.Logger) Option

SetLogger option allows set a custom logger.

func SetPrefix

func SetPrefix(s string) Option

SetPrefix option allows set a prefix to collection.

Jump to

Keyboard shortcuts

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