Documentation ¶
Index ¶
- Constants
- func ForEach(tx *bolt.Tx, cond func([]byte, int) bool, eachDo func(*DB) error) error
- func ParseHeadResponse(res []string, datfile string) map[string]*Head
- type DB
- type Head
- type Map
- type Record
- func (r *Record) AttachPath(thumbnailSize string) string
- func (r *Record) Build(stamp int64, body map[string]string, passwd string) string
- func (r *Record) CheckData(begin, end int64) error
- func (r *Record) CopyHead() Head
- func (r *Record) GetBodyValue(k string, def string) string
- func (r *Record) GetData(n *node.Node) error
- func (r *Record) Getbody() string
- func (r *Record) HasBodyValue(k string) bool
- func (r *Record) InRange(begin, end int64, id string) bool
- func (r *Record) IsSpam() bool
- func (r *Record) Load() error
- func (r *Record) MakeAttachLink(sakuHost string) string
- func (r *Record) Meets(begin, end int64) bool
- func (r *Record) Parse(recstr string) error
- func (r *Record) Recstr() string
- func (r *Record) ShortPubkey() string
- func (r *Record) Sync()
- func (r *Record) SyncTX(tx *bolt.Tx, deleted bool) error
Constants ¶
const ( //Alive counts records that are not removed. Alive = 1 //Removed counts records that are removed. Removed = 2 //All counts all records All = 3 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶ added in v0.2.0
DB represents one record in db.
func GetFromDBs ¶ added in v0.2.0
GetFromDBs gets DBs whose thread name is datfile.
type Head ¶
type Head struct { Datfile string //cache file name Stamp int64 //unixtime ID string //md5(bodystr) }
Head represents one line in updatelist/recentlist
type Map ¶
Map is a map key=stamp_id, value=record.
func FromRecordDB ¶
FromRecordDB makes record map from record db.
type Record ¶
type Record struct { *Head // contains filtered or unexported fields }
Record represents one record.
func NewIDstr ¶
NewIDstr parse idstr unixtime+"_"+md5(bodystr)), set stamp and id, and return record obj. if parse failes returns nil.
func (*Record) AttachPath ¶
AttachPath returns attach path by creating path from args.
func (*Record) CheckData ¶
CheckData makes records 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 count of added records to the cache and spam/getting error.
func (*Record) GetBodyValue ¶
GetBodyValue returns value of key k return def if not exists.
func (*Record) GetData ¶
GetData gets records from node n and checks its is same as stamp and id in args. save recs if success. returns errSpam or errGet.
func (*Record) HasBodyValue ¶
HasBodyValue returns true if key k exists used in templates
func (*Record) MakeAttachLink ¶
MakeAttachLink makes and returns attached file link.
func (*Record) Parse ¶
Parse parses one line in record file and response of /recent/ and set params to record r.
func (*Record) ShortPubkey ¶
ShortPubkey returns short version of pubkey. used in templates