Documentation ¶
Overview ¶
Package serverlog maintains logs for directory servers, permitting replay, recovering, and mirroring.
Index ¶
- Variables
- func HasLog(user upspin.UserName, directory string) (bool, error)
- func ListUsers(directory string) ([]upspin.UserName, error)
- func ListUsersWithSuffix(suffix, directory string) ([]upspin.UserName, error)
- type Entry
- type Operation
- type Reader
- type User
- func (u *User) Append(e *Entry) error
- func (u *User) AppendOffset() int64
- func (u *User) Close() error
- func (u *User) DeleteLogs() error
- func (u *User) DeleteRoot() error
- func (u *User) Name() upspin.UserName
- func (u *User) NewReader() (*Reader, error)
- func (u *User) OffsetOf(seq int64) int64
- func (u *User) ReadOffset() (int64, error)
- func (u *User) ReadOnlyClone() (*User, error)
- func (u *User) Root() (*upspin.DirEntry, error)
- func (u *User) SaveOffset(offset int64) error
- func (u *User) SaveRoot(root *upspin.DirEntry) error
- func (u *User) Truncate(offset int64) error
- func (u *User) V1Transition() upspin.Time
- func (u *User) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
var MaxLogSize int64 = 100 * 1024 * 1024 // 100 MB
MaxLogSize is the maximum size of a single log file. It can be modified, such as for testing.
Functions ¶
func ListUsersWithSuffix ¶
ListUsersWithSuffix returns a list is user names found in the given log directory that contain the required suffix, without the leading "+". The special suffix "*" matches all users with a non-empty suffix.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads LogEntries from the log.
func (*Reader) EndOffset ¶
EndOffset returns the offset of the end of the current file or -1 on error. TODO: Used only in a test in ../tree. Could be deleted.
type User ¶
type User struct {
// contains filtered or unexported fields
}
User holds the log state for a single user.
func Open ¶
func Open(userName upspin.UserName, directory string, fac upspin.Factotum, store storage.Storage) (*User, error)
Open returns a User structure holding the open logs for the user in the named local file system's directory. If the user does not already have logs in this directory, Open will create them.
If a store is provided then the root will be backed up to that storage backend whenever it changes, so that the tree may be recovered in the event that the log directory is lost or corrupted. If store is non-nil then the provided factotum must also be non-nil, as it is used to geneate the secret reference under which the root is backed up.
Only one User can be opened for a given user in a given directory or logs could be corrupted. It is the caller's responsibility to provide this guarantee.
func (*User) AppendOffset ¶
AppendOffset returns the offset of the end of the written log file or -1 on error.
func (*User) DeleteLogs ¶
DeleteLogs deletes all data for a user in its directory. Any existing logs associated with user must not be used subsequently.
func (*User) OffsetOf ¶
OffsetOf returns the global offset in the user's logs for this sequence number. It returns -1 if the sequence number does not appear in the logs. ReadAt will return an error if asked to read at a negative offset.
func (*User) ReadOffset ¶
ReadOffset reads from stable storage the offset saved by SaveOffset.
func (*User) ReadOnlyClone ¶
ReadOnlyClone returns a copy of the user structure with no writer, creating a read-only accessor for the logs.
func (*User) SaveOffset ¶
SaveOffset saves to stable storage the offset to process next.
func (*User) V1Transition ¶
V1Transition returns a time that marks the transition from old (version 0) logs to version 1. DirEntries created before this time use the old Sequence number scheme, in which the upper 23 bits are noise. These should be cleared before reporting the sequence number to the client.