Documentation ¶
Index ¶
- Constants
- Variables
- func FastUID() uint64
- func GenerateCryptoRandomString(n int, runes string) (string, error)
- func UID() (uint64, error)
- type AppendEvent
- type AppendFunc
- type Consumer
- type ConsumerFunc
- type Create
- type File
- func (f *File) Append(reserve int64, appender AppendFunc) error
- func (f *File) Close() error
- func (f *File) Finalize() error
- func (f *File) ID() string
- func (f *File) IsAnonymous() bool
- func (f *File) IsClosed() bool
- func (f *File) IsReadOnly() bool
- func (f *File) ReadAt(b []byte, index int64) (int, error)
- func (f *File) ReadView(cb ViewCallback) error
- func (f *File) Size() int64
- func (f *File) Subscribe(wait waiter.Waiter, consumer ConsumerFunc) (*Consumer, error)
- func (f *File) Truncate(size int64) error
- func (f *File) Write(b []byte) (int, error)
- func (f *File) WriteAt(b []byte, index int64) (int, error)
- func (f *File) WriteView(begin, end int64, cb ViewCallback) error
- type MMap
- type Manager
- type Open
- type ReadEvent
- type Stats
- type ViewCallback
Constants ¶
const ( // RDONLY maps the memory read-only. // Attempts to write to the MMap object will result in undefined behavior. RDONLY = 0 // RDWR maps the memory as read-write. Writes to the MMap object will update the // underlying file. RDWR = 1 << iota // COPY maps the memory as copy-on-write. Writes to the MMap object will affect // memory, but the underlying file will remain unchanged. COPY // If EXEC is set, the mapped memory is marked as executable. EXEC )
const ( // If the ANON flag is set, the mapped memory will not be backed by a file. ANON = 1 << iota )
Variables ¶
Functions ¶
func GenerateCryptoRandomString ¶
GenerateCryptoRandomString generates a random string for cryptographic usage.
Types ¶
type AppendEvent ¶
type AppendFunc ¶
type AppendFunc func(event AppendEvent) (int64, error)
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
func (*Consumer) ReadView ¶
func (c *Consumer) ReadView(callback ViewCallback) error
type ConsumerFunc ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File
func (*File) Append ¶
func (f *File) Append(reserve int64, appender AppendFunc) error
Append allocates the requested size to the end of the file
func (*File) IsAnonymous ¶
func (*File) IsReadOnly ¶
func (*File) ReadView ¶
func (f *File) ReadView(cb ViewCallback) error
type MMap ¶
type MMap []byte
MMap represents a file mapped into memory.
func MapRegion ¶
MapRegion maps part of a file into memory. The offset parameter must be a multiple of the system's page size. If size < 0, the entire file will be mapped. If ANON is set in flags, f is ignored.
func (MMap) Lock ¶
Lock keeps the mapped region in physical memory, ensuring that it will not be swapped out.
func (MMap) Unlock ¶
Unlock reverses the effect of Lock, allowing the mapped region to potentially be swapped out. If data is already unlocked, aan error will result.
func (*MMap) Unmap ¶
Unmap deletes the memory mapped region, flushes any remaining changes, and sets data to nil. Trying to read or write any remaining references to data after Unmap is called will result in undefined behavior. Unmap should only be called on the slice value that was originally returned from a call to Map. Calling Unmap on a derived slice may cause errors.
type Stats ¶
type Stats struct { Creates Counter CreatesDur TimeCounter Opens Counter OpensDur TimeCounter Closes Counter CloseDur TimeCounter ActiveMaps Counter ActiveMemory Counter ActiveAnonymousMemory Counter LifetimeMemory Counter Flushes Counter FlushesDur TimeCounter FlushErrors Counter FlushErrorsDur TimeCounter Extends Counter ExtendsDur TimeCounter Maps Counter MapsDur TimeCounter MapErrors Counter MapErrorsDur TimeCounter Unmaps Counter UnmapsDur TimeCounter UnmapErrors Counter UnmapErrorsDur TimeCounter Finalizes Counter FinalizesDur TimeCounter Truncates Counter TruncatesDur TimeCounter TruncateErrors Counter TruncateErrorsDur TimeCounter }