gobrr

package module
v0.0.0-...-e436038 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 4 Imported by: 0

README

gobrr

This is an experimental package, and is unfit for production use. gobrr provides an in memory filesystem to any go program. This filesystem aims to speedup temporary file I/O by storing everything in memory. The gobrr filesystem will provide all necessary means of file interaction such as os.File, file paths, and file descriptors gobrr is built as a wrapper around memfd_create and as such will only work on linux systems.

This package is largely inspired by this blog post by Terin Stock and I would like to thank him for his work

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFilePathToMemfile

func CopyFilePathToMemfile(path string) (*os.File, error)

CopyFilePathToMemfile takes a file path and copies the data from the file at that location into a memfile

func CopyFileToMemfile

func CopyFileToMemfile(oldFile *os.File) (*os.File, error)

CopyFileToMemfile takes an os.File pointer and copies the data from that file into a memfile

func CopyMemfileToBytes

func CopyMemfileToBytes(memfile *os.File) ([]byte, error)

CopyMemfileToBytes is just a speedy way to retrieve the data stored in a memfile

func CreateEmptyMemfile

func CreateEmptyMemfile() (*os.File, error)

CreateEmptyMemfile creates an empty file in memory, and returns an os.File pointer to that file. This file acts like any other file on disk, it may be read from and written to. Both a valid path and a valid file descriptor may be obtained for this file by using either File.Name(), or File.Fd() respectively. When the file is no longer needed it must be closed like any other file, however once it is closed its contents are lost

func CreateMemfileFromData

func CreateMemfileFromData(b []byte) (*os.File, error)

CreateMemfileFromData is equivalent to calling CreateEmptyMemfile then calling File.Write() on the result, however this function should theoretically outperform the aforementioned option due to its used of POSIX's mmap

Types

This section is empty.

Jump to

Keyboard shortcuts

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