Documentation ¶
Index ¶
- Constants
- Variables
- func DisableLog()
- func New(anp *chaincfg.Params, root string, fnotimeHost string, gitPath string, ...) (*gitBackEnd, error)
- func UseLogger(logger slog.Logger)
- type Anchor
- type AnchorType
- type CastVoteJournal
- type FlushRecord
- type GitCommit
- type Journal
- type JournalAction
- type LastAnchor
- type UnconfirmedAnchor
Constants ¶
const ( // Following are what should be well-known interface hooks PluginPostHookEdit = "postedit" // Hook Post Edit // Authorize vote actions AuthVoteActionAuthorize = "authorize" // Authorize a proposal vote AuthVoteActionRevoke = "revoke" // Revoke a proposal vote authorization )
const ( // LockDuration is the maximum lock time duration allowed. 15 seconds // is ~3x of anchoring without internet delay. LockDuration = 15 * time.Second // defaultUnvettedPath is the landing zone for unvetted content. DefaultUnvettedPath = "unvetted" // defaultVettedPath is the publicly visible git vetted record repo. DefaultVettedPath = "vetted" // defaultJournalsPath is the path where data is journaled and/or // cached. DefaultJournalsPath = "journals" // XXX it looks like this belongs in plugins )
Variables ¶
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
Types ¶
type Anchor ¶
type Anchor struct { Type AnchorType // Type of anchor this record represents Time int64 // OS time when record was created Digests [][]byte // All digests that were merkled to get to key of record Messages []string // All one-line Commit messages }
type AnchorType ¶
type AnchorType uint32
AnchorType discriminates between the various Anchor record types.
const ( AnchorInvalid AnchorType = 0 // Invalid anchor AnchorUnverified AnchorType = 1 // Unverified anchor AnchorVerified AnchorType = 2 // Verified anchor )
type CastVoteJournal ¶
type CastVoteJournal struct { CastVote foneroplugin.CastVote `json:"castvote"` // Client side vote Receipt string `json:"receipt"` // Signature of CastVote.Signature }
type FlushRecord ¶
type FlushRecord struct { Version string `json:"version"` // Version Timestamp string `json:"timestamp"` // Timestamp }
FlushRecord is a structure that is stored on disk when a journal has been flushed.
type Journal ¶
Journal is a generic 1:N file journaler. It uses an in memory mutex to coordinate all actions on disk. The journaler assumes text files that are "\n" delineated.
func NewJournal ¶
func NewJournal() *Journal
NewJournal creates a new Journal context. One can use a single journal context for many journals.
func (*Journal) Close ¶
Close closes the underlying journal file. If the journal file is not found the function returns ErrNotFound.
func (*Journal) Copy ¶
Copy copies a journal file from source to destination. During the copy process the source file remains locked. This call has the same error semantics as the Open call.
func (*Journal) Journal ¶
Journal writes content to a journal file. Note that content should not be bigger than bufio.Scanner can read per line. If the user does not provide "\n" at the end of content string, this function appends it.
type JournalAction ¶
type JournalAction struct { Version string `json:"version"` // Version Action string `json:"action"` // Add/Del }
JournalAction prefixes and determines what the next structure is in the JSON journal. Version is used to determine what version of the comment journal structure follows. journalActionAdd -> Add entry journalActionDel -> Delete entry journalActionAddLike -> Add comment like structure (comments only)
type LastAnchor ¶
type LastAnchor struct { Last []byte // Last git digest that was anchored Time int64 // OS time when record was created Merkle []byte // Merkle root that points to Anchor record, if valid }
LastAnchor stores the last commit anchored in fnotime.
type UnconfirmedAnchor ¶
type UnconfirmedAnchor struct {
Merkles [][]byte // List of Merkle root that points to Anchor records
}
UnconfirmedAnchor stores Merkle roots of anchors that have not been confirmed yet by fnotime.