nonews

package module
v0.0.0-...-1428558 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2014 License: AGPL-3.0 Imports: 9 Imported by: 0

README

No news is good news.

Documentation

Index

Constants

View Source
const (
	NfoPart  = PartType("nfo")
	SfvPart  = PartType("sfv")
	RarPart  = PartType("rar")
	Par2Part = PartType("par2")
)
View Source
const (
	DbName             = "nonews"
	ArticlesCollection = "articles"
	HeadChunkSize      = 1024
)

Variables

View Source
var ErrMalformedXref = fmt.Errorf("malformed xref")
View Source
var MeterFrequency = 10 * time.Second

Functions

func ParsePostingDate

func ParsePostingDate(s string) (time.Time, error)

Types

type Article

type Article struct {
	Header map[string][]string

	MessageId string
	Subject   string
	Xref      []Xref
	Timestamp int64

	Part Part

	Errors []error `bson:",omitempty"`
}

func NewArticle

func NewArticle(a *nntp.Article) *Article

type Client

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

func NewClient

func NewClient(config *Config) *Client

func (*Client) Articles

func (c *Client) Articles(group string, start, end int) chan *Article

func (*Client) Group

func (c *Client) Group(name string) chan *Group

func (*Client) Start

func (c *Client) Start(n int)

type Config

type Config struct {
	*toml.TomlTree
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) Addr

func (c *Config) Addr() string

func (*Config) GroupDelay

func (c *Config) GroupDelay(group string) int

func (*Config) IndexGroups

func (c *Config) IndexGroups() []string

func (*Config) MongoURL

func (c *Config) MongoURL() string

func (*Config) Password

func (c *Config) Password() string

func (*Config) TLS

func (c *Config) TLS() bool

func (*Config) Username

func (c *Config) Username() string

func (*Config) Valid

func (c *Config) Valid() error

type Group

type Group struct {
	*nntp.Group

	Errors []error
}

type Indexer

type Indexer struct {
	Config *Config
	Group  string
	// contains filtered or unexported fields
}

func NewIndexer

func NewIndexer(group string, config *Config) (*Indexer, error)

func (*Indexer) Start

func (idx *Indexer) Start(client *Client)

type Part

type Part struct {
	Collection string
	Num        int
	Total      int
	Type       PartType
}

type PartType

type PartType string

type Xref

type Xref struct {
	Server string `bson:",omitempty"`
	Group  string
	Number int
}

func ParseXref

func ParseXref(xref string) ([]Xref, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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