Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Methods
- breakHardlink
- checkVersion
- checksumB64FromBytes
- checksumB64ToBytes
- checksumBytesPeek
- checksumBytesPeekValidate
- checksumFile
- checksumFileAsync
- checksumFileAsyncFinish
- checksumFileAt
- checksumFileFromInput
- checksumFromBytes
- checksumFromBytesV
- checksumInplaceToBytes
- checksumToBytes
- checksumToBytesV
- cmd_Private #method:cmd_Private#
- cmpChecksumBytes
- commitGetContentChecksum
- commitGetObjectSizes
- commitGetParent
- commitGetTimestamp
- commitMetadataForBootable
- contentFileParse
- contentFileParseAt
- contentStreamParse
- createDirectoryMetadata
- diffDirs
- diffDirsWithOptions
- diffPrint
- gpgErrorQuark
- hashObjectName
- metadataVariantType
- objectFromString
- objectNameDeserialize
- objectNameSerialize
- objectToString
- objectTypeFromString
- objectTypeToString
- parseRefspec
- rawFileToArchiveZ2Stream
- rawFileToArchiveZ2StreamWithOptions
- rawFileToContentStream
- validateChecksumString
- validateCollectionId
- validateRemoteName
- validateRev
- validateStructureofChecksumString
- validateStructureofCommit
- validateStructureofCsumV
- validateStructureofDirmeta
- validateStructureofDirtree
- validateStructureofFileMode
- validateStructureofObjtype
Synopsis
- breakHardlink :: (HasCallStack, MonadIO m, IsCancellable a) => Int32 -> Text -> Bool -> Maybe a -> m ()
- checkVersion :: (HasCallStack, MonadIO m) => Word32 -> Word32 -> m Bool
- checksumB64FromBytes :: (HasCallStack, MonadIO m) => ByteString -> m Text
- checksumB64ToBytes :: (HasCallStack, MonadIO m) => Text -> m ByteString
- checksumBytesPeek :: (HasCallStack, MonadIO m) => GVariant -> m ByteString
- checksumBytesPeekValidate :: (HasCallStack, MonadIO m) => GVariant -> m ByteString
- checksumFile :: (HasCallStack, MonadIO m, IsFile a, IsCancellable b) => a -> ObjectType -> Maybe b -> m ByteString
- checksumFileAsync :: (HasCallStack, MonadIO m, IsFile a, IsCancellable b) => a -> ObjectType -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- checksumFileAsyncFinish :: (HasCallStack, MonadIO m, IsFile a, IsAsyncResult b) => a -> b -> m ByteString
- checksumFileAt :: (HasCallStack, MonadIO m, IsCancellable a) => Int32 -> Text -> Ptr () -> ObjectType -> [ChecksumFlags] -> Text -> Maybe a -> m ()
- checksumFileFromInput :: (HasCallStack, MonadIO m, IsFileInfo a, IsInputStream b, IsCancellable c) => a -> Maybe GVariant -> Maybe b -> ObjectType -> Maybe c -> m ByteString
- checksumFromBytes :: (HasCallStack, MonadIO m) => ByteString -> m Text
- checksumFromBytesV :: (HasCallStack, MonadIO m) => GVariant -> m Text
- checksumInplaceToBytes :: (HasCallStack, MonadIO m) => Text -> Word8 -> m ()
- checksumToBytes :: (HasCallStack, MonadIO m) => Text -> m ByteString
- checksumToBytesV :: (HasCallStack, MonadIO m) => Text -> m GVariant
- cmd_Private__ :: (HasCallStack, MonadIO m) => m CmdPrivateVTable
- cmpChecksumBytes :: (HasCallStack, MonadIO m) => Word8 -> Word8 -> m Int32
- commitGetContentChecksum :: (HasCallStack, MonadIO m) => GVariant -> m (Maybe Text)
- commitGetObjectSizes :: (HasCallStack, MonadIO m) => GVariant -> m [CommitSizesEntry]
- commitGetParent :: (HasCallStack, MonadIO m) => GVariant -> m Text
- commitGetTimestamp :: (HasCallStack, MonadIO m) => GVariant -> m Word64
- commitMetadataForBootable :: (HasCallStack, MonadIO m, IsFile a, IsCancellable b) => a -> VariantDict -> Maybe b -> m ()
- contentFileParse :: (HasCallStack, MonadIO m, IsFile a, IsCancellable b) => Bool -> a -> Bool -> Maybe b -> m (InputStream, FileInfo, GVariant)
- contentFileParseAt :: (HasCallStack, MonadIO m, IsCancellable a) => Bool -> Int32 -> Text -> Bool -> Maybe a -> m (InputStream, FileInfo, GVariant)
- contentStreamParse :: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) => Bool -> a -> Word64 -> Bool -> Maybe b -> m (InputStream, FileInfo, GVariant)
- createDirectoryMetadata :: (HasCallStack, MonadIO m, IsFileInfo a) => a -> Maybe GVariant -> m GVariant
- diffDirs :: (HasCallStack, MonadIO m, IsFile a, IsFile b, IsCancellable c) => [DiffFlags] -> a -> b -> [DiffItem] -> [File] -> [File] -> Maybe c -> m ()
- diffDirsWithOptions :: (HasCallStack, MonadIO m, IsFile a, IsFile b, IsCancellable c) => [DiffFlags] -> a -> b -> [DiffItem] -> [File] -> [File] -> Maybe DiffDirsOptions -> Maybe c -> m ()
- diffPrint :: (HasCallStack, MonadIO m, IsFile a, IsFile b) => a -> b -> [DiffItem] -> [File] -> [File] -> m ()
- gpgErrorQuark :: (HasCallStack, MonadIO m) => m Word32
- hashObjectName :: (HasCallStack, MonadIO m) => Ptr () -> m Word32
- metadataVariantType :: (HasCallStack, MonadIO m) => ObjectType -> m VariantType
- objectFromString :: (HasCallStack, MonadIO m) => Text -> m (Text, ObjectType)
- objectNameDeserialize :: (HasCallStack, MonadIO m) => GVariant -> m (Text, ObjectType)
- objectNameSerialize :: (HasCallStack, MonadIO m) => Text -> ObjectType -> m GVariant
- objectToString :: (HasCallStack, MonadIO m) => Text -> ObjectType -> m Text
- objectTypeFromString :: (HasCallStack, MonadIO m) => Text -> m ObjectType
- objectTypeToString :: (HasCallStack, MonadIO m) => ObjectType -> m Text
- parseRefspec :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text, Text)
- rawFileToArchiveZ2Stream :: (HasCallStack, MonadIO m, IsInputStream a, IsFileInfo b, IsCancellable c) => a -> b -> Maybe GVariant -> Maybe c -> m InputStream
- rawFileToArchiveZ2StreamWithOptions :: (HasCallStack, MonadIO m, IsInputStream a, IsFileInfo b, IsCancellable c) => a -> b -> Maybe GVariant -> Maybe GVariant -> Maybe c -> m InputStream
- rawFileToContentStream :: (HasCallStack, MonadIO m, IsInputStream a, IsFileInfo b, IsCancellable c) => a -> b -> Maybe GVariant -> Maybe c -> m (InputStream, Word64)
- validateChecksumString :: (HasCallStack, MonadIO m) => Text -> m ()
- validateCollectionId :: (HasCallStack, MonadIO m) => Maybe Text -> m ()
- validateRemoteName :: (HasCallStack, MonadIO m) => Text -> m ()
- validateRev :: (HasCallStack, MonadIO m) => Text -> m ()
- validateStructureofChecksumString :: (HasCallStack, MonadIO m) => Text -> m ()
- validateStructureofCommit :: (HasCallStack, MonadIO m) => GVariant -> m ()
- validateStructureofCsumV :: (HasCallStack, MonadIO m) => GVariant -> m ()
- validateStructureofDirmeta :: (HasCallStack, MonadIO m) => GVariant -> m ()
- validateStructureofDirtree :: (HasCallStack, MonadIO m) => GVariant -> m ()
- validateStructureofFileMode :: (HasCallStack, MonadIO m) => Word32 -> m ()
- validateStructureofObjtype :: (HasCallStack, MonadIO m) => Word8 -> m ()
Methods
breakHardlink
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> Int32 |
|
-> Text |
|
-> Bool |
|
-> Maybe a | |
-> m () | (Can throw |
In many cases using libostree, a program may need to "break" hardlinks by performing a copy. For example, in order to logically append to a file.
This function performs full copying, including e.g. extended attributes and permissions of both regular files and symbolic links.
If the file is not hardlinked, this function does nothing and returns successfully.
This function does not perform synchronization via fsync()
or
fdatasync()
; the idea is this will commonly be done as part
of an ostree_repo_commit_transaction()
, which itself takes
care of synchronization.
Since: 2017.15
checkVersion
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> Word32 |
|
-> m Bool | Returns: |
No description available in the introspection data.
Since: 2017.4
checksumB64FromBytes
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> m Text | Returns: Modified base64 encoding of The "modified" term refers to the fact that instead of '/', the '_' character is used. |
No description available in the introspection data.
Since: 2016.8
checksumB64ToBytes
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m ByteString | Returns: Binary version of |
No description available in the introspection data.
Since: 2016.8
checksumBytesPeek
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m ByteString | Returns: Binary checksum data in |
No description available in the introspection data.
checksumBytesPeekValidate
checksumBytesPeekValidate Source #
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m ByteString | Returns: Binary checksum data (Can throw |
Like checksumBytesPeek
, but also throws error
.
checksumFile
:: (HasCallStack, MonadIO m, IsFile a, IsCancellable b) | |
=> a |
|
-> ObjectType |
|
-> Maybe b |
|
-> m ByteString | (Can throw |
Compute the OSTree checksum for a given file.
checksumFileAsync
:: (HasCallStack, MonadIO m, IsFile a, IsCancellable b) | |
=> a |
|
-> ObjectType |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously compute the OSTree checksum for a given file;
complete with checksumFileAsyncFinish
.
checksumFileAsyncFinish
checksumFileAsyncFinish Source #
:: (HasCallStack, MonadIO m, IsFile a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m ByteString | (Can throw |
Finish computing the OSTree checksum for a given file; see
checksumFileAsync
.
checksumFileAt
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> Int32 |
|
-> Text |
|
-> Ptr () | |
-> ObjectType |
|
-> [ChecksumFlags] |
|
-> Text | |
-> Maybe a |
|
-> m () | (Can throw |
Compute the OSTree checksum for a given file. This is an fd-relative version
of checksumFile
which also takes flags and fills in a caller
allocated buffer.
Since: 2017.13
checksumFileFromInput
checksumFileFromInput Source #
:: (HasCallStack, MonadIO m, IsFileInfo a, IsInputStream b, IsCancellable c) | |
=> a |
|
-> Maybe GVariant |
|
-> Maybe b |
|
-> ObjectType |
|
-> Maybe c |
|
-> m ByteString | (Can throw |
Compute the OSTree checksum for a given input.
checksumFromBytes
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> m Text | Returns: String form of |
No description available in the introspection data.
checksumFromBytesV
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m Text | Returns: String form of |
No description available in the introspection data.
checksumInplaceToBytes
checksumInplaceToBytes Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Word8 |
|
-> m () |
Convert checksum
from a string to binary in-place, without
allocating memory. Use this function in hot code paths.
checksumToBytes
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m ByteString | Returns: Binary checksum from |
No description available in the introspection data.
checksumToBytesV
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m GVariant | Returns: New |
No description available in the introspection data.
cmd_Private #method:cmd_Private#
cmd_Private__ :: (HasCallStack, MonadIO m) => m CmdPrivateVTable Source #
No description available in the introspection data.
cmpChecksumBytes
:: (HasCallStack, MonadIO m) | |
=> Word8 |
|
-> Word8 |
|
-> m Int32 |
Compare two binary checksums, using memcmp()
.
commitGetContentChecksum
commitGetContentChecksum Source #
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m (Maybe Text) | Returns: A SHA-256 hex string, or |
There are use cases where one wants a checksum just of the content of a commit. OSTree commits by default capture the current timestamp, and may have additional metadata, which means that re-committing identical content often results in a new checksum.
By comparing checksums of content, it's possible to easily distinguish cases where nothing actually changed.
The content checksums is simply defined as SHA256(root dirtree_checksum || root_dirmeta_checksum)
,
i.e. the SHA-256 of the root "dirtree" object's checksum concatenated with the
root "dirmeta" checksum (both in binary form, not hexadecimal).
Since: 2018.2
commitGetObjectSizes
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m [CommitSizesEntry] | (Can throw |
Reads a commit's "ostree.sizes" metadata and returns an array of
CommitSizesEntry
in outSizesEntries
. Each element
represents an object in the commit. If the commit does not contain
the "ostree.sizes" metadata, a IOErrorEnumNotFound
error will be
returned.
Since: 2020.1
commitGetParent
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m Text | Returns: Checksum of the parent commit of |
No description available in the introspection data.
commitGetTimestamp
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m Word64 | Returns: timestamp in seconds since the Unix epoch, UTC |
No description available in the introspection data.
Since: 2016.3
commitMetadataForBootable
commitMetadataForBootable Source #
:: (HasCallStack, MonadIO m, IsFile a, IsCancellable b) | |
=> a |
|
-> VariantDict |
|
-> Maybe b | |
-> m () | (Can throw |
Update provided dict
with standard metadata for bootable OSTree commits.
Since: 2021.1
contentFileParse
:: (HasCallStack, MonadIO m, IsFile a, IsCancellable b) | |
=> Bool |
|
-> a |
|
-> Bool |
|
-> Maybe b |
|
-> m (InputStream, FileInfo, GVariant) | (Can throw |
A thin wrapper for contentStreamParse
; this function
converts an object content stream back into components.
contentFileParseAt
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> Bool |
|
-> Int32 |
|
-> Text |
|
-> Bool |
|
-> Maybe a |
|
-> m (InputStream, FileInfo, GVariant) | (Can throw |
A thin wrapper for contentStreamParse
; this function
converts an object content stream back into components.
contentStreamParse
:: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) | |
=> Bool |
|
-> a |
|
-> Word64 |
|
-> Bool |
|
-> Maybe b |
|
-> m (InputStream, FileInfo, GVariant) | (Can throw |
The reverse of rawFileToContentStream
; this function
converts an object content stream back into components.
createDirectoryMetadata
createDirectoryMetadata Source #
:: (HasCallStack, MonadIO m, IsFileInfo a) | |
=> a |
|
-> Maybe GVariant |
|
-> m GVariant | Returns: A new |
No description available in the introspection data.
diffDirs
:: (HasCallStack, MonadIO m, IsFile a, IsFile b, IsCancellable c) | |
=> [DiffFlags] |
|
-> a |
|
-> b |
|
-> [DiffItem] |
|
-> [File] |
|
-> [File] |
|
-> Maybe c |
|
-> m () | (Can throw |
Compute the difference between directory a
and b
as 3 separate
sets of DiffItem
in modified
, removed
, and added
.
diffDirsWithOptions
:: (HasCallStack, MonadIO m, IsFile a, IsFile b, IsCancellable c) | |
=> [DiffFlags] |
|
-> a |
|
-> b |
|
-> [DiffItem] |
|
-> [File] |
|
-> [File] |
|
-> Maybe DiffDirsOptions |
|
-> Maybe c |
|
-> m () | (Can throw |
Compute the difference between directory a
and b
as 3 separate
sets of DiffItem
in modified
, removed
, and added
.
Since: 2017.4
diffPrint
:: (HasCallStack, MonadIO m, IsFile a, IsFile b) | |
=> a |
|
-> b |
|
-> [DiffItem] |
|
-> [File] |
|
-> [File] |
|
-> m () |
Print the contents of a diff to stdout.
gpgErrorQuark
gpgErrorQuark :: (HasCallStack, MonadIO m) => m Word32 Source #
No description available in the introspection data.
Since: 2017.10
hashObjectName
:: (HasCallStack, MonadIO m) | |
=> Ptr () |
|
-> m Word32 |
Use this function with HashTable
and objectNameSerialize
.
metadataVariantType
metadataVariantType :: (HasCallStack, MonadIO m) => ObjectType -> m VariantType Source #
No description available in the introspection data.
objectFromString
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Text, ObjectType) |
Reverse objectToString
.
objectNameDeserialize
objectNameDeserialize Source #
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m (Text, ObjectType) |
Reverse objectNameSerialize
. Note that outChecksum
is
only valid for the lifetime of variant
, and must not be freed.
objectNameSerialize
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> ObjectType |
|
-> m GVariant | Returns: A new floating |
No description available in the introspection data.
objectToString
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> ObjectType |
|
-> m Text | Returns: A string containing both |
No description available in the introspection data.
objectTypeFromString
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m ObjectType |
The reverse of objectTypeToString
.
objectTypeToString
:: (HasCallStack, MonadIO m) | |
=> ObjectType |
|
-> m Text |
Serialize objtype
to a string; this is used for file extensions.
parseRefspec
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text, Text) | (Can throw |
Split a refspec like gnome-ostree:gnome-ostree/buildmain
or just
gnome-ostree/buildmain
into two parts. In the first case, outRemote
will be set to gnome-ostree
, and outRef
to gnome-ostree/buildmain
.
In the second case (a local ref), outRemote
will be Nothing
, and outRef
will be gnome-ostree/buildmain
. In both cases, True
will be returned.
rawFileToArchiveZ2Stream
rawFileToArchiveZ2Stream Source #
:: (HasCallStack, MonadIO m, IsInputStream a, IsFileInfo b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe GVariant |
|
-> Maybe c |
|
-> m InputStream | (Can throw |
Convert from a "bare" file representation into an OSTREE_OBJECT_TYPE_FILE stream suitable for ostree pull.
Since: 2016.6
rawFileToArchiveZ2StreamWithOptions
rawFileToArchiveZ2StreamWithOptions Source #
:: (HasCallStack, MonadIO m, IsInputStream a, IsFileInfo b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe GVariant |
|
-> Maybe GVariant |
|
-> Maybe c |
|
-> m InputStream | (Can throw |
Like rawFileToArchiveZ2Stream
, but supports an extensible set
of flags. The following flags are currently defined:
compression-level
(i
): Level of compression to use, 0–9, with 0 being the least compression, and <0 giving the default level (currently 6).
Since: 2017.3
rawFileToContentStream
rawFileToContentStream Source #
:: (HasCallStack, MonadIO m, IsInputStream a, IsFileInfo b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe GVariant |
|
-> Maybe c |
|
-> m (InputStream, Word64) | (Can throw |
Convert from a "bare" file representation into an
OSTREE_OBJECT_TYPE_FILE stream. This is a fundamental operation
for writing data to an Repo
.
validateChecksumString
validateChecksumString Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m () | (Can throw |
Use this function to see if input strings are checksums.
validateCollectionId
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> m () | (Can throw |
Check whether the given collectionId
is valid. Return an error if it is
invalid or Nothing
.
Valid collection IDs are reverse DNS names:
* They are composed of 1 or more elements separated by a period (.
) character.
All elements must contain at least one character.
* Each element must only contain the ASCII characters [A-Z][a-z][0-9]_
and must not
begin with a digit.
* They must contain at least one .
(period) character (and thus at least two elements).
* They must not begin with a .
(period) character.
* They must not exceed 255 characters in length.
(This makes their format identical to D-Bus interface names, for consistency.)
Since: 2018.6
validateRemoteName
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m () | (Can throw |
No description available in the introspection data.
Since: 2017.8
validateRev
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m () | (Can throw |
No description available in the introspection data.
validateStructureofChecksumString
validateStructureofChecksumString Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m () | (Can throw |
No description available in the introspection data.
validateStructureofCommit
validateStructureofCommit Source #
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m () | (Can throw |
Use this to validate the basic structure of commit
, independent of
any other objects it references.
validateStructureofCsumV
validateStructureofCsumV Source #
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m () | (Can throw |
No description available in the introspection data.
validateStructureofDirmeta
validateStructureofDirmeta Source #
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m () | (Can throw |
Use this to validate the basic structure of dirmeta
.
validateStructureofDirtree
validateStructureofDirtree Source #
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m () | (Can throw |
Use this to validate the basic structure of dirtree
, independent of
any other objects it references.
validateStructureofFileMode
validateStructureofFileMode Source #
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m () | (Can throw |
No description available in the introspection data.
validateStructureofObjtype
validateStructureofObjtype Source #
:: (HasCallStack, MonadIO m) | |
=> Word8 | |
-> m () | (Can throw |
No description available in the introspection data.