pcat

package
v0.0.0-...-bcdc67c Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2015 License: BSD-3-Clause, BSD-3-Clause Imports: 8 Imported by: 0

README

This is a goinstall-able mirror of modified code already published at:
http://git.nic.cz/redmine/projects/godns/repository/show/pcat

Online godoc documentation for this package (should be) available at:
http://gopkgdoc.appspot.com/pkg/github.com/cznic/dns/pcat

Documentation

Overview

Package pcat supports reading files produced by the pcat utility which is a part of the NLnet Labs' ldns project.

See also: http://www.nlnetlabs.nl/svn/ldns/trunk/pcat/README.pcat

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scan

func Scan(name string, src io.ByteReader, handler func(*Record) bool) (err error)

Scan scans a pcat formatted text file from src, assuming file name is 'name'. Handler 'handler' is called for every Record found in src. If handler returns false the scanning process is aborted and Scan returns err == nil. If there is any error detected while scanning then the scanning is aborted as well and the error is returned.

Types

type DB

type DB struct {
	*zdb.Store
	// contains filtered or unexported fields
}

DB represents a pcat data store. It is intended for temporary DBs of e.g. some analytical tools. It has a rather big size overhead (~16M).

func NewDB

func NewDB(fn string) (db *DB, err error)

NewDB creates the DB in named file fn, truncating it if it already exists. If successful, methods on the returned DB can be used for I/O. It returns the DB and an error, if any.

func OpenDB

func OpenDB(fn string) (db *DB, err error)

OpenDB opens a DB in/from named file fn. If successful, methods on the returned DB can be used for data exchange. OpenDB returns the DB and an error, if any.

func (*DB) Close

func (db *DB) Close() error

Close closes the DB. Further access to the DB has undefined behavior and may panic. It returns an error, if any.

func (*DB) RGet

func (db *DB) RGet(partition uint32, Id int) (r Record, ok bool, err error)

RGet reads the Record associated with partition and Id. It returns the data, key exists in ok and an error, if any. Get may return a non nil err iff !ok.

func (*DB) RSet

func (db *DB) RSet(partition uint32, r *Record) (err error)

RSet stores r under partition and returns an error if any.

type Record

type Record struct {
	Id    int    // Sequential number
	Query []byte // What was sent to server in wire format
	Reply []byte // What was received from server in wire format
}

Record captures data from one record in the pcat produced text file.

func (*Record) String

func (r *Record) String() string

Implementation of fmt.Stringer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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