vector-mmap-0.0.3: Memory map immutable and mutable vectors

Safe HaskellNone
LanguageHaskell98

Data.Vector.Storable.MMap

Synopsis

Documentation

data Mode :: * #

Mode of mapping. Four cases are supported.

Constructors

ReadOnly

file is mapped read-only, file must exist

ReadWrite

file is mapped read-write, file must exist

WriteCopy

file is mapped read-write, but changes aren't propagated to disk, file must exist

ReadWriteEx

file is mapped read-write, if file does not exist it will be created with default permissions, region parameter specifies size, if file size is lower it will be extended with zeros

Instances

Enum Mode 

Methods

succ :: Mode -> Mode #

pred :: Mode -> Mode #

toEnum :: Int -> Mode #

fromEnum :: Mode -> Int #

enumFrom :: Mode -> [Mode] #

enumFromThen :: Mode -> Mode -> [Mode] #

enumFromTo :: Mode -> Mode -> [Mode] #

enumFromThenTo :: Mode -> Mode -> Mode -> [Mode] #

Eq Mode 

Methods

(==) :: Mode -> Mode -> Bool #

(/=) :: Mode -> Mode -> Bool #

Ord Mode 

Methods

compare :: Mode -> Mode -> Ordering #

(<) :: Mode -> Mode -> Bool #

(<=) :: Mode -> Mode -> Bool #

(>) :: Mode -> Mode -> Bool #

(>=) :: Mode -> Mode -> Bool #

max :: Mode -> Mode -> Mode #

min :: Mode -> Mode -> Mode #

Read Mode 
Show Mode 

Methods

showsPrec :: Int -> Mode -> ShowS #

show :: Mode -> String #

showList :: [Mode] -> ShowS #

unsafeMMapMVector Source #

Arguments

:: Storable a 
=> FilePath

Path of the file to map

-> Mode

Mapping mode

-> Maybe (Int64, Int)

Nothing to map entire file into memory, otherwise 'Just (fileOffset, elementCount)'

-> IO (MVector (PrimState IO) a) 

Map a file into memory as a mutable vector.

unsafeMMapVector Source #

Arguments

:: Storable a 
=> FilePath

Path of the file to map

-> Maybe (Int64, Int)

Nothing to map entire file into memory, otherwise 'Just (fileOffset, elementCount)'

-> IO (Vector a) 

Map a file into memory (ReadOnly mode) as an immutable vector.

writeMMapVector Source #

Arguments

:: (Storable a, Vector v a) 
=> FilePath

Path of the file to map

-> v a

Vector to write

-> IO () 

Write a file from a vector Be careful with existing files, parts behind the mapped range will stay as they are before the write operation.