lazymem

package module
v0.0.0-...-46dc427 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClonedBuffer

type ClonedBuffer interface {
	io.ReaderAt
	io.Closer
}

ClonedBuffer's content may be read repeatedly.

type Config

type Config struct {
	Mountpoint string
	ErrorLog   Logger
	DebugLog   Logger
}

Config for the memory filesystem.

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

Logger for error and/or debug messages. Subset of log.Logger.

type Manager

type Manager struct {
	Config
	// contains filtered or unexported fields
}

Manager of lazy memory. It is backed by a custom filesystem implementation.

func New

func New(ctx context.Context, config *Config) (m *Manager, err error)

New mounts a filesystem instance.

func (*Manager) Create

func (m *Manager) Create(size int64, mode int, b SharedBuffer) (fd int, err error)

Create a file descriptor which should be passed to another process for memory mapping. The memory can be mapped multiple times as PROT_SHARED and/or PROT_PRIVATE.

In case of failure, no SharedBuffer methods have been invoked.

func (*Manager) CreateCloned

func (m *Manager) CreateCloned(size int64, mode int, b ClonedBuffer) (fd int, err error)

CreateCloned memory file descriptor which should be passed to another process for mapping. The memory can be mapped multiple times as PROT_PRIVATE.

In case of failure, no ClonedBuffer methods have been invoked.

func (*Manager) CreateTemporal

func (m *Manager) CreateTemporal(size int64, mode int, b TemporalBuffer) (fd int, err error)

CreateTemporal memory file descriptor which should be passed to another process for mapping. The memory can be mapped once as PROT_PRIVATE.

func (*Manager) Shutdown

func (m *Manager) Shutdown(ctx context.Context) (err error)

Shutdown unmounts the filesystem.

type SharedBuffer

type SharedBuffer interface {
	io.ReaderAt
	io.WriterAt
	io.Closer
}

SharedBuffer's content may be overwritten. A range won't be written to before it has been read at least once.

type TemporalBuffer

type TemporalBuffer interface {
	io.ReaderAt
}

TemporalBuffer's content will be read at most once (per range).

Directories

Path Synopsis
Package linear implements ClonedBuffer and SharedBuffer.
Package linear implements ClonedBuffer and SharedBuffer.
Package sparse implements TemporalBuffer.
Package sparse implements TemporalBuffer.

Jump to

Keyboard shortcuts

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