mmap

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mmap memory map file Copyright (C) 2020 to All Authors. all rights reserved. Author Ron Date 2020/08/24 09:03:51 Version 1.0

Package mmap memory map uitls Copyright (C) 2020 to All Authors. all rights reserved. Author Ron Date 2020/08/24 10:53:20 Version 1.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lock

func Lock(data []byte) error

Lock locks all the mapped memory to RAM, preventing the pages from swapping out.

func Random

func Random(data []byte) error

Random Access Memory Random.

func Unlock

func Unlock(data []byte) error

Unlock unlocks the mapped memory from RAM, enabling swapping out of RAM if required.

Types

type Mmap

type Mmap interface {
	Open(offset int64, size int) error
	Close() error
	Flush() error
	ReadAt(dest []byte, offset int64) (int, error)
	WriteAt(src []byte, offset int64) (int, error)
}

Mmap map file to memory.

func NewRO

func NewRO(f *os.File) (Mmap, error)

NewRO create new Read Only Mmap instance.

func NewRW

func NewRW(f *os.File) (Mmap, error)

NewRW create new read and write mmap.

Jump to

Keyboard shortcuts

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