thread

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2017 License: BSD-3-Clause Imports: 11 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanRecords added in v0.1.0

func CleanRecords()

CleanRecords remove old or duplicates records for each Caches.

func CreateAllCachedirs added in v0.1.0

func CreateAllCachedirs()

CreateAllCachedirs creates all dirs in recentlist to be retrived when called recentlist.getall. (heavymoon)

func Len added in v0.1.0

func Len() int

Len returns # of Caches

func RemoveRemoved added in v0.1.0

func RemoveRemoved()

RemoveRemoved removes files in removed dir if old.

Types

type Cache

type Cache struct {
	Datfile string
}

Cache represents cache of one file.

func NewCache

func NewCache(datfile string) *Cache

NewCache read tag files to set and returns cache obj. it uses sync.pool to ensure that only one cache obj exists for one datfile. and garbage collected when not used.

func (*Cache) CheckData added in v0.1.0

func (c *Cache) CheckData(tx *bolt.Tx, res string, stamp int64,
	id string, begin, end int64) error

CheckData makes a record from res and checks its records meets condisions of args. adds the rec to cache if meets conditions. if spam or big data, remove the rec from disk. returns spam/getting error.

func (*Cache) Exists

func (c *Cache) Exists() bool

Exists return true is datapath exists.

func (*Cache) GetContents

func (c *Cache) GetContents() []string

GetContents returns recstrs of cache. len(recstrs) is <=2. used in templates

func (*Cache) Gettitle

func (c *Cache) Gettitle() string

Gettitle returns title part if *_*. returns ca.datfile if not. used in templates

func (*Cache) HasRecord

func (c *Cache) HasRecord() bool

HasRecord return true if cache has more than one records or removed records.

func (*Cache) Len added in v0.1.0

func (c *Cache) Len(kind int) int

Len returns # of records in the cache.

func (*Cache) LoadRecords

func (c *Cache) LoadRecords(kind int) record.Map

LoadRecords loads and returns record maps from the disk..

func (*Cache) RecentStamp

func (c *Cache) RecentStamp() int64

RecentStamp returns time of getting by /recent.

func (*Cache) Remove

func (c *Cache) Remove()

Remove Remove all files and dirs of cache.

func (*Cache) Size added in v0.1.0

func (c *Cache) Size() int64

Size returns sum of body char length of records in the cache.

func (*Cache) Stamp added in v0.1.0

func (c *Cache) Stamp() int64

Stamp returns latest stampl of records in the cache.

func (*Cache) Subscribe added in v0.1.0

func (c *Cache) Subscribe()

Subscribe add the thread to thread db.

func (*Cache) Velocity added in v0.1.0

func (c *Cache) Velocity() int

Velocity returns number of records in one days in the cache.

type Caches

type Caches []*Cache

Caches is a slice of *cache

func AllCaches added in v0.1.0

func AllCaches() Caches

AllCaches returns all thread names

func MakeRecentCachelist added in v0.1.0

func MakeRecentCachelist() Caches

MakeRecentCachelist returns sorted cachelist copied from Recentlist. which doens't contain duplicate Caches.

func Search(q string) Caches

Search reloads records in Caches in cachelist and returns slice of cache which matches query.

func (Caches) Has

func (c Caches) Has(cc *Cache) bool

Has return true is Caches has cache cc

func (Caches) Len

func (c Caches) Len() int

Len returns size of cache slice.

type SortByStamp

type SortByStamp struct {
	Caches
	// contains filtered or unexported fields
}

SortByStamp is for sorting by stamp.

func NewSortByStamp

func NewSortByStamp(cs Caches, recentStamp bool) *SortByStamp

NewSortByStamp makes stamps for caches and returns SortByStamp obj.

func (*SortByStamp) Less

func (c *SortByStamp) Less(i, j int) bool

Less returns true if cache[i].stamp < cache[j].stamp.

func (*SortByStamp) Swap

func (c *SortByStamp) Swap(i, j int)

Swap swaps order of cache slice.

type SortByVelocity

type SortByVelocity struct {
	Caches
	// contains filtered or unexported fields
}

SortByVelocity is for sorting by velocity.

func NewSortByVelocity

func NewSortByVelocity(cs Caches) *SortByVelocity

NewSortByVelocity makes velocity for caches and returns SortByVelocity obj.

func (*SortByVelocity) Less

func (c *SortByVelocity) Less(i, j int) bool

Less returns true if cache[i].velocity < cache[j].velocity. if velocity[i]==velocity[j], returns true if cache[i].size< cache[j].size.

func (*SortByVelocity) Swap

func (c *SortByVelocity) Swap(i, j int)

Swap swaps order of cache slice.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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