edf

package
v0.0.0-...-93838e3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EDF_VERSION is the file format version
	EDF_VERSION = 1
	// EDF_LENGTH is th number of OS pages in each slice
	EDF_LENGTH = 32
	// EDF_SIZE sets the maximum size of the mapping, represented with
	// EDF_LENGTH segments
	// Currently set arbitrarily to 128 MiB
	EDF_SIZE = 128 * (1024 * 1024)
)
View Source
const (
	// EDF_READ_ONLY means the file will only be read, modifications fail
	EDF_READ_ONLY = iota
	// EDF_READ_WRITE specifies that the file will be read and written
	EDF_READ_WRITE
	// EDF_CREATE means the file will be created and opened with EDF_READ_WRITE
	EDF_CREATE
)
View Source
const (
	// EDF_UNMAP_NOSYNC means the file won't be
	// Sync'd to disk before unmapping
	EDF_UNMAP_NOSYNC = iota
	// EDF_UNMAP_SYNC synchronises the EDF file to disk
	// during unmapping
	EDF_UNMAP_SYNC
)

Variables

This section is empty.

Functions

func NewThread

func NewThread(e *EdfFile, name string) *thread

NewThread returns a new thread.

Types

type EdfFile

type EdfFile struct {
	// contains filtered or unexported fields
}

EdfFile represents a mapped file on disk or and anonymous mapping for instance storage

func EdfAnonMap

func EdfAnonMap() (*EdfFile, error)

EdfAnonMap maps the EdfFile structure into RAM IMPORTANT: everything's lost if unmapped

func (*EdfFile) AllocPages

func (e *EdfFile) AllocPages(pagesRequested uint32, thread uint32) (edfRange, error)

AllocPages allocates a |pagesRequested| chunk of pages on the thread with the given identifier. Returns an edfRange describing the result.

func (*EdfFile) FindThread

func (e *EdfFile) FindThread(targetName string) (uint32, error)

FindThread obtains the index of a thread in the EdfFile.

func (*EdfFile) GetPageSize

func (e *EdfFile) GetPageSize() uint64

GetPageSize returns the pageSize of an EdfFile

func (*EdfFile) GetThreads

func (e *EdfFile) GetThreads() (map[uint32]string, error)

GetThreads returns the thread identifier -> name map.

func (*EdfFile) ResolveRange

func (e *EdfFile) ResolveRange(r edfRange) [][]byte

ResolveRange returns a slice of byte slices representing the underlying memory referenced by edfRange.

WARNING: slow.

func (*EdfFile) WriteThread

func (e *EdfFile) WriteThread(t *thread) error

WriteThread inserts a new thread into the EdfFile.

Jump to

Keyboard shortcuts

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