{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) Private instance structure. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.OSTree.Objects.MutableTree ( #if ENABLE_OVERLOADING MutableTreeGetSubdirsMethodInfo , #endif -- * Exported types MutableTree(..) , IsMutableTree , toMutableTree , noMutableTree , -- * Methods -- ** checkError #method:checkError# #if ENABLE_OVERLOADING MutableTreeCheckErrorMethodInfo , #endif mutableTreeCheckError , -- ** ensureDir #method:ensureDir# #if ENABLE_OVERLOADING MutableTreeEnsureDirMethodInfo , #endif mutableTreeEnsureDir , -- ** ensureParentDirs #method:ensureParentDirs# #if ENABLE_OVERLOADING MutableTreeEnsureParentDirsMethodInfo , #endif mutableTreeEnsureParentDirs , -- ** fillEmptyFromDirtree #method:fillEmptyFromDirtree# #if ENABLE_OVERLOADING MutableTreeFillEmptyFromDirtreeMethodInfo, #endif mutableTreeFillEmptyFromDirtree , -- ** getContentsChecksum #method:getContentsChecksum# #if ENABLE_OVERLOADING MutableTreeGetContentsChecksumMethodInfo, #endif mutableTreeGetContentsChecksum , -- ** getFiles #method:getFiles# #if ENABLE_OVERLOADING MutableTreeGetFilesMethodInfo , #endif mutableTreeGetFiles , -- ** getMetadataChecksum #method:getMetadataChecksum# #if ENABLE_OVERLOADING MutableTreeGetMetadataChecksumMethodInfo, #endif mutableTreeGetMetadataChecksum , -- ** lookup #method:lookup# #if ENABLE_OVERLOADING MutableTreeLookupMethodInfo , #endif mutableTreeLookup , -- ** new #method:new# mutableTreeNew , -- ** newFromChecksum #method:newFromChecksum# mutableTreeNewFromChecksum , -- ** remove #method:remove# #if ENABLE_OVERLOADING MutableTreeRemoveMethodInfo , #endif mutableTreeRemove , -- ** replaceFile #method:replaceFile# #if ENABLE_OVERLOADING MutableTreeReplaceFileMethodInfo , #endif mutableTreeReplaceFile , -- ** setContentsChecksum #method:setContentsChecksum# #if ENABLE_OVERLOADING MutableTreeSetContentsChecksumMethodInfo, #endif mutableTreeSetContentsChecksum , -- ** setMetadataChecksum #method:setMetadataChecksum# #if ENABLE_OVERLOADING MutableTreeSetMetadataChecksumMethodInfo, #endif mutableTreeSetMetadataChecksum , -- ** walk #method:walk# #if ENABLE_OVERLOADING MutableTreeWalkMethodInfo , #endif mutableTreeWalk , ) where import Data.GI.Base.ShortPrelude import qualified Data.GI.Base.ShortPrelude as SP import qualified Data.GI.Base.Overloading as O import qualified Prelude as P import qualified Data.GI.Base.Attributes as GI.Attributes import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import qualified GI.GObject.Objects.Object as GObject.Object import {-# SOURCE #-} qualified GI.OSTree.Objects.Repo as OSTree.Repo -- | Memory-managed wrapper type. newtype MutableTree = MutableTree (ManagedPtr MutableTree) foreign import ccall "ostree_mutable_tree_get_type" c_ostree_mutable_tree_get_type :: IO GType instance GObject MutableTree where gobjectType = c_ostree_mutable_tree_get_type -- | Type class for types which can be safely cast to `MutableTree`, for instance with `toMutableTree`. class (GObject o, O.IsDescendantOf MutableTree o) => IsMutableTree o instance (GObject o, O.IsDescendantOf MutableTree o) => IsMutableTree o instance O.HasParentTypes MutableTree type instance O.ParentTypes MutableTree = '[GObject.Object.Object] -- | Cast to `MutableTree`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`. toMutableTree :: (MonadIO m, IsMutableTree o) => o -> m MutableTree toMutableTree = liftIO . unsafeCastTo MutableTree -- | A convenience alias for `Nothing` :: `Maybe` `MutableTree`. noMutableTree :: Maybe MutableTree noMutableTree = Nothing #if ENABLE_OVERLOADING type family ResolveMutableTreeMethod (t :: Symbol) (o :: *) :: * where ResolveMutableTreeMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo ResolveMutableTreeMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo ResolveMutableTreeMethod "checkError" o = MutableTreeCheckErrorMethodInfo ResolveMutableTreeMethod "ensureDir" o = MutableTreeEnsureDirMethodInfo ResolveMutableTreeMethod "ensureParentDirs" o = MutableTreeEnsureParentDirsMethodInfo ResolveMutableTreeMethod "fillEmptyFromDirtree" o = MutableTreeFillEmptyFromDirtreeMethodInfo ResolveMutableTreeMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo ResolveMutableTreeMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo ResolveMutableTreeMethod "getv" o = GObject.Object.ObjectGetvMethodInfo ResolveMutableTreeMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo ResolveMutableTreeMethod "lookup" o = MutableTreeLookupMethodInfo ResolveMutableTreeMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo ResolveMutableTreeMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo ResolveMutableTreeMethod "ref" o = GObject.Object.ObjectRefMethodInfo ResolveMutableTreeMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo ResolveMutableTreeMethod "remove" o = MutableTreeRemoveMethodInfo ResolveMutableTreeMethod "replaceFile" o = MutableTreeReplaceFileMethodInfo ResolveMutableTreeMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo ResolveMutableTreeMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo ResolveMutableTreeMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo ResolveMutableTreeMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo ResolveMutableTreeMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo ResolveMutableTreeMethod "walk" o = MutableTreeWalkMethodInfo ResolveMutableTreeMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo ResolveMutableTreeMethod "getContentsChecksum" o = MutableTreeGetContentsChecksumMethodInfo ResolveMutableTreeMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo ResolveMutableTreeMethod "getFiles" o = MutableTreeGetFilesMethodInfo ResolveMutableTreeMethod "getMetadataChecksum" o = MutableTreeGetMetadataChecksumMethodInfo ResolveMutableTreeMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo ResolveMutableTreeMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo ResolveMutableTreeMethod "getSubdirs" o = MutableTreeGetSubdirsMethodInfo ResolveMutableTreeMethod "setContentsChecksum" o = MutableTreeSetContentsChecksumMethodInfo ResolveMutableTreeMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo ResolveMutableTreeMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo ResolveMutableTreeMethod "setMetadataChecksum" o = MutableTreeSetMetadataChecksumMethodInfo ResolveMutableTreeMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo ResolveMutableTreeMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveMutableTreeMethod t MutableTree, O.MethodInfo info MutableTree p) => OL.IsLabel t (MutableTree -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #else fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #endif #endif #if ENABLE_OVERLOADING instance O.HasAttributeList MutableTree type instance O.AttributeList MutableTree = MutableTreeAttributeList type MutableTreeAttributeList = ('[ ] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING #endif #if ENABLE_OVERLOADING type instance O.SignalList MutableTree = MutableTreeSignalList type MutableTreeSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)]) #endif -- method MutableTree::new -- method type : Constructor -- Args : [] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "OSTree", name = "MutableTree"})) -- throws : False -- Skip return : False foreign import ccall "ostree_mutable_tree_new" ostree_mutable_tree_new :: IO (Ptr MutableTree) {- | /No description available in the introspection data./ -} mutableTreeNew :: (B.CallStack.HasCallStack, MonadIO m) => m MutableTree {- ^ __Returns:__ A new tree -} mutableTreeNew = liftIO $ do result <- ostree_mutable_tree_new checkUnexpectedReturnNULL "mutableTreeNew" result result' <- (wrapObject MutableTree) result return result' #if ENABLE_OVERLOADING #endif -- method MutableTree::new_from_checksum -- method type : Constructor -- Args : [Arg {argCName = "repo", argType = TInterface (Name {namespace = "OSTree", name = "Repo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The repo which contains the objects refered by the checksums.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "contents_checksum", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "dirtree checksum", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "metadata_checksum", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "dirmeta checksum", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "OSTree", name = "MutableTree"})) -- throws : False -- Skip return : False foreign import ccall "ostree_mutable_tree_new_from_checksum" ostree_mutable_tree_new_from_checksum :: Ptr OSTree.Repo.Repo -> -- repo : TInterface (Name {namespace = "OSTree", name = "Repo"}) CString -> -- contents_checksum : TBasicType TUTF8 CString -> -- metadata_checksum : TBasicType TUTF8 IO (Ptr MutableTree) {- | Creates a new OstreeMutableTree with the contents taken from the given repo and checksums. The data will be loaded from the repo lazily as needed. -} mutableTreeNewFromChecksum :: (B.CallStack.HasCallStack, MonadIO m, OSTree.Repo.IsRepo a) => a {- ^ /@repo@/: The repo which contains the objects refered by the checksums. -} -> T.Text {- ^ /@contentsChecksum@/: dirtree checksum -} -> T.Text {- ^ /@metadataChecksum@/: dirmeta checksum -} -> m MutableTree {- ^ __Returns:__ A new tree -} mutableTreeNewFromChecksum repo contentsChecksum metadataChecksum = liftIO $ do repo' <- unsafeManagedPtrCastPtr repo contentsChecksum' <- textToCString contentsChecksum metadataChecksum' <- textToCString metadataChecksum result <- ostree_mutable_tree_new_from_checksum repo' contentsChecksum' metadataChecksum' checkUnexpectedReturnNULL "mutableTreeNewFromChecksum" result result' <- (wrapObject MutableTree) result touchManagedPtr repo freeMem contentsChecksum' freeMem metadataChecksum' return result' #if ENABLE_OVERLOADING #endif -- method MutableTree::check_error -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Tree", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ostree_mutable_tree_check_error" ostree_mutable_tree_check_error :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) Ptr (Ptr GError) -> -- error IO CInt {- | In some cases, a tree may be in a \"lazy\" state that loads data in the background; if an error occurred during a non-throwing API call, it will have been cached. This function checks for a cached error. The tree remains in error state. /Since: 2018.7/ -} mutableTreeCheckError :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a {- ^ /@self@/: Tree -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} mutableTreeCheckError self = liftIO $ do self' <- unsafeManagedPtrCastPtr self onException (do _ <- propagateGError $ ostree_mutable_tree_check_error self' touchManagedPtr self return () ) (do return () ) #if ENABLE_OVERLOADING data MutableTreeCheckErrorMethodInfo instance (signature ~ (m ()), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeCheckErrorMethodInfo a signature where overloadedMethod _ = mutableTreeCheckError #endif -- method MutableTree::ensure_dir -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Tree", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of subdirectory of self to retrieve/creates", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_subdir", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the subdirectory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ostree_mutable_tree_ensure_dir" ostree_mutable_tree_ensure_dir :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) CString -> -- name : TBasicType TUTF8 Ptr (Ptr MutableTree) -> -- out_subdir : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) Ptr (Ptr GError) -> -- error IO CInt {- | Returns the subdirectory of self with filename /@name@/, creating an empty one it if it doesn\'t exist. -} mutableTreeEnsureDir :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a {- ^ /@self@/: Tree -} -> T.Text {- ^ /@name@/: Name of subdirectory of self to retrieve\/creates -} -> m (MutableTree) {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} mutableTreeEnsureDir self name = liftIO $ do self' <- unsafeManagedPtrCastPtr self name' <- textToCString name outSubdir <- allocMem :: IO (Ptr (Ptr MutableTree)) onException (do _ <- propagateGError $ ostree_mutable_tree_ensure_dir self' name' outSubdir outSubdir' <- peek outSubdir outSubdir'' <- (wrapObject MutableTree) outSubdir' touchManagedPtr self freeMem name' freeMem outSubdir return outSubdir'' ) (do freeMem name' freeMem outSubdir ) #if ENABLE_OVERLOADING data MutableTreeEnsureDirMethodInfo instance (signature ~ (T.Text -> m (MutableTree)), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeEnsureDirMethodInfo a signature where overloadedMethod _ = mutableTreeEnsureDir #endif -- method MutableTree::ensure_parent_dirs -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Tree", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "split_path", argType = TPtrArray (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "File path components", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "metadata_checksum", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "SHA256 checksum for metadata", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_parent", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The parent tree", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ostree_mutable_tree_ensure_parent_dirs" ostree_mutable_tree_ensure_parent_dirs :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) Ptr (GPtrArray CString) -> -- split_path : TPtrArray (TBasicType TUTF8) CString -> -- metadata_checksum : TBasicType TUTF8 Ptr (Ptr MutableTree) -> -- out_parent : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) Ptr (Ptr GError) -> -- error IO CInt {- | Create all parent trees necessary for the given /@splitPath@/ to exist. -} mutableTreeEnsureParentDirs :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a {- ^ /@self@/: Tree -} -> [T.Text] {- ^ /@splitPath@/: File path components -} -> T.Text {- ^ /@metadataChecksum@/: SHA256 checksum for metadata -} -> m (MutableTree) {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} mutableTreeEnsureParentDirs self splitPath metadataChecksum = liftIO $ do self' <- unsafeManagedPtrCastPtr self splitPath' <- mapM textToCString splitPath splitPath'' <- packGPtrArray splitPath' metadataChecksum' <- textToCString metadataChecksum outParent <- allocMem :: IO (Ptr (Ptr MutableTree)) onException (do _ <- propagateGError $ ostree_mutable_tree_ensure_parent_dirs self' splitPath'' metadataChecksum' outParent outParent' <- peek outParent outParent'' <- (wrapObject MutableTree) outParent' touchManagedPtr self mapPtrArray freeMem splitPath'' unrefPtrArray splitPath'' freeMem metadataChecksum' freeMem outParent return outParent'' ) (do mapPtrArray freeMem splitPath'' unrefPtrArray splitPath'' freeMem metadataChecksum' freeMem outParent ) #if ENABLE_OVERLOADING data MutableTreeEnsureParentDirsMethodInfo instance (signature ~ ([T.Text] -> T.Text -> m (MutableTree)), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeEnsureParentDirsMethodInfo a signature where overloadedMethod _ = mutableTreeEnsureParentDirs #endif -- method MutableTree::fill_empty_from_dirtree -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "repo", argType = TInterface (Name {namespace = "OSTree", name = "Repo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "contents_checksum", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "metadata_checksum", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "ostree_mutable_tree_fill_empty_from_dirtree" ostree_mutable_tree_fill_empty_from_dirtree :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) Ptr OSTree.Repo.Repo -> -- repo : TInterface (Name {namespace = "OSTree", name = "Repo"}) CString -> -- contents_checksum : TBasicType TUTF8 CString -> -- metadata_checksum : TBasicType TUTF8 IO CInt {- | Merges /@self@/ with the tree given by /@contentsChecksum@/ and /@metadataChecksum@/, but only if it\'s possible without writing new objects to the /@repo@/. We can do this if either /@self@/ is empty, the tree given by /@contentsChecksum@/ is empty or if both trees already have the same /@contentsChecksum@/. -} mutableTreeFillEmptyFromDirtree :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a, OSTree.Repo.IsRepo b) => a -> b -> T.Text -> T.Text -> m Bool {- ^ __Returns:__ /@tRUE@/ if merge was successful, /@fALSE@/ if it was not possible. This function enables optimisations when composing trees. The provided checksums are not loaded or checked when this function is called. Instead the contents will be loaded only when needed. -} mutableTreeFillEmptyFromDirtree self repo contentsChecksum metadataChecksum = liftIO $ do self' <- unsafeManagedPtrCastPtr self repo' <- unsafeManagedPtrCastPtr repo contentsChecksum' <- textToCString contentsChecksum metadataChecksum' <- textToCString metadataChecksum result <- ostree_mutable_tree_fill_empty_from_dirtree self' repo' contentsChecksum' metadataChecksum' let result' = (/= 0) result touchManagedPtr self touchManagedPtr repo freeMem contentsChecksum' freeMem metadataChecksum' return result' #if ENABLE_OVERLOADING data MutableTreeFillEmptyFromDirtreeMethodInfo instance (signature ~ (b -> T.Text -> T.Text -> m Bool), MonadIO m, IsMutableTree a, OSTree.Repo.IsRepo b) => O.MethodInfo MutableTreeFillEmptyFromDirtreeMethodInfo a signature where overloadedMethod _ = mutableTreeFillEmptyFromDirtree #endif -- method MutableTree::get_contents_checksum -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "ostree_mutable_tree_get_contents_checksum" ostree_mutable_tree_get_contents_checksum :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) IO CString {- | /No description available in the introspection data./ -} mutableTreeGetContentsChecksum :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a -> m T.Text mutableTreeGetContentsChecksum self = liftIO $ do self' <- unsafeManagedPtrCastPtr self result <- ostree_mutable_tree_get_contents_checksum self' checkUnexpectedReturnNULL "mutableTreeGetContentsChecksum" result result' <- cstringToText result touchManagedPtr self return result' #if ENABLE_OVERLOADING data MutableTreeGetContentsChecksumMethodInfo instance (signature ~ (m T.Text), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeGetContentsChecksumMethodInfo a signature where overloadedMethod _ = mutableTreeGetContentsChecksum #endif -- method MutableTree::get_files -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TGHash (TBasicType TUTF8) (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "ostree_mutable_tree_get_files" ostree_mutable_tree_get_files :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) IO (Ptr (GHashTable CString CString)) {- | /No description available in the introspection data./ -} mutableTreeGetFiles :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a -> m (Map.Map T.Text T.Text) {- ^ __Returns:__ All children files (the value is a checksum) -} mutableTreeGetFiles self = liftIO $ do self' <- unsafeManagedPtrCastPtr self result <- ostree_mutable_tree_get_files self' checkUnexpectedReturnNULL "mutableTreeGetFiles" result result' <- unpackGHashTable result let result'' = mapFirst cstringUnpackPtr result' result''' <- mapFirstA cstringToText result'' let result'''' = mapSecond cstringUnpackPtr result''' result''''' <- mapSecondA cstringToText result'''' let result'''''' = Map.fromList result''''' touchManagedPtr self return result'''''' #if ENABLE_OVERLOADING data MutableTreeGetFilesMethodInfo instance (signature ~ (m (Map.Map T.Text T.Text)), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeGetFilesMethodInfo a signature where overloadedMethod _ = mutableTreeGetFiles #endif -- method MutableTree::get_metadata_checksum -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "ostree_mutable_tree_get_metadata_checksum" ostree_mutable_tree_get_metadata_checksum :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) IO CString {- | /No description available in the introspection data./ -} mutableTreeGetMetadataChecksum :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a -> m T.Text mutableTreeGetMetadataChecksum self = liftIO $ do self' <- unsafeManagedPtrCastPtr self result <- ostree_mutable_tree_get_metadata_checksum self' checkUnexpectedReturnNULL "mutableTreeGetMetadataChecksum" result result' <- cstringToText result touchManagedPtr self return result' #if ENABLE_OVERLOADING data MutableTreeGetMetadataChecksumMethodInfo instance (signature ~ (m T.Text), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeGetMetadataChecksumMethodInfo a signature where overloadedMethod _ = mutableTreeGetMetadataChecksum #endif -- XXX Could not generate method MutableTree::get_subdirs -- Error was : Not implemented: "GHashTable element of type TInterface (Name {namespace = \"OSTree\", name = \"MutableTree\"}) unsupported." #if ENABLE_OVERLOADING -- XXX: Dummy instance, since code generation failed. -- Please file a bug at http://github.com/haskell-gi/haskell-gi. data MutableTreeGetSubdirsMethodInfo instance (p ~ (), o ~ O.MethodResolutionFailed "getSubdirs" MutableTree) => O.MethodInfo MutableTreeGetSubdirsMethodInfo o p where overloadedMethod _ = undefined #endif -- method MutableTree::lookup -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_file_checksum", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_subdir", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ostree_mutable_tree_lookup" ostree_mutable_tree_lookup :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) CString -> -- name : TBasicType TUTF8 CString -> -- out_file_checksum : TBasicType TUTF8 Ptr MutableTree -> -- out_subdir : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) Ptr (Ptr GError) -> -- error IO CInt {- | /No description available in the introspection data./ -} mutableTreeLookup :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a, IsMutableTree b) => a -> T.Text -> T.Text -> b -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} mutableTreeLookup self name outFileChecksum outSubdir = liftIO $ do self' <- unsafeManagedPtrCastPtr self name' <- textToCString name outFileChecksum' <- textToCString outFileChecksum outSubdir' <- unsafeManagedPtrCastPtr outSubdir onException (do _ <- propagateGError $ ostree_mutable_tree_lookup self' name' outFileChecksum' outSubdir' touchManagedPtr self touchManagedPtr outSubdir freeMem name' freeMem outFileChecksum' return () ) (do freeMem name' freeMem outFileChecksum' ) #if ENABLE_OVERLOADING data MutableTreeLookupMethodInfo instance (signature ~ (T.Text -> T.Text -> b -> m ()), MonadIO m, IsMutableTree a, IsMutableTree b) => O.MethodInfo MutableTreeLookupMethodInfo a signature where overloadedMethod _ = mutableTreeLookup #endif -- method MutableTree::remove -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Tree", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of file or subdirectory to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allow_noent", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "If @FALSE, an error will be thrown if @name does not exist in the tree", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ostree_mutable_tree_remove" ostree_mutable_tree_remove :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) CString -> -- name : TBasicType TUTF8 CInt -> -- allow_noent : TBasicType TBoolean Ptr (Ptr GError) -> -- error IO CInt {- | Remove the file or subdirectory named /@name@/ from the mutable tree /@self@/. -} mutableTreeRemove :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a {- ^ /@self@/: Tree -} -> T.Text {- ^ /@name@/: Name of file or subdirectory to remove -} -> Bool {- ^ /@allowNoent@/: If /@fALSE@/, an error will be thrown if /@name@/ does not exist in the tree -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} mutableTreeRemove self name allowNoent = liftIO $ do self' <- unsafeManagedPtrCastPtr self name' <- textToCString name let allowNoent' = (fromIntegral . fromEnum) allowNoent onException (do _ <- propagateGError $ ostree_mutable_tree_remove self' name' allowNoent' touchManagedPtr self freeMem name' return () ) (do freeMem name' ) #if ENABLE_OVERLOADING data MutableTreeRemoveMethodInfo instance (signature ~ (T.Text -> Bool -> m ()), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeRemoveMethodInfo a signature where overloadedMethod _ = mutableTreeRemove #endif -- method MutableTree::replace_file -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "checksum", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ostree_mutable_tree_replace_file" ostree_mutable_tree_replace_file :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) CString -> -- name : TBasicType TUTF8 CString -> -- checksum : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CInt {- | /No description available in the introspection data./ -} mutableTreeReplaceFile :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a -> T.Text -> T.Text -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} mutableTreeReplaceFile self name checksum = liftIO $ do self' <- unsafeManagedPtrCastPtr self name' <- textToCString name checksum' <- textToCString checksum onException (do _ <- propagateGError $ ostree_mutable_tree_replace_file self' name' checksum' touchManagedPtr self freeMem name' freeMem checksum' return () ) (do freeMem name' freeMem checksum' ) #if ENABLE_OVERLOADING data MutableTreeReplaceFileMethodInfo instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeReplaceFileMethodInfo a signature where overloadedMethod _ = mutableTreeReplaceFile #endif -- method MutableTree::set_contents_checksum -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "checksum", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "ostree_mutable_tree_set_contents_checksum" ostree_mutable_tree_set_contents_checksum :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) CString -> -- checksum : TBasicType TUTF8 IO () {- | /No description available in the introspection data./ -} mutableTreeSetContentsChecksum :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a -> T.Text -> m () mutableTreeSetContentsChecksum self checksum = liftIO $ do self' <- unsafeManagedPtrCastPtr self checksum' <- textToCString checksum ostree_mutable_tree_set_contents_checksum self' checksum' touchManagedPtr self freeMem checksum' return () #if ENABLE_OVERLOADING data MutableTreeSetContentsChecksumMethodInfo instance (signature ~ (T.Text -> m ()), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeSetContentsChecksumMethodInfo a signature where overloadedMethod _ = mutableTreeSetContentsChecksum #endif -- method MutableTree::set_metadata_checksum -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "checksum", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "ostree_mutable_tree_set_metadata_checksum" ostree_mutable_tree_set_metadata_checksum :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) CString -> -- checksum : TBasicType TUTF8 IO () {- | /No description available in the introspection data./ -} mutableTreeSetMetadataChecksum :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a -> T.Text -> m () mutableTreeSetMetadataChecksum self checksum = liftIO $ do self' <- unsafeManagedPtrCastPtr self checksum' <- textToCString checksum ostree_mutable_tree_set_metadata_checksum self' checksum' touchManagedPtr self freeMem checksum' return () #if ENABLE_OVERLOADING data MutableTreeSetMetadataChecksumMethodInfo instance (signature ~ (T.Text -> m ()), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeSetMetadataChecksumMethodInfo a signature where overloadedMethod _ = mutableTreeSetMetadataChecksum #endif -- method MutableTree::walk -- method type : OrdinaryMethod -- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Tree", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "split_path", argType = TPtrArray (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Split pathname", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Descend from this number of elements in @split_path", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_subdir", argType = TInterface (Name {namespace = "OSTree", name = "MutableTree"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Target parent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ostree_mutable_tree_walk" ostree_mutable_tree_walk :: Ptr MutableTree -> -- self : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) Ptr (GPtrArray CString) -> -- split_path : TPtrArray (TBasicType TUTF8) Word32 -> -- start : TBasicType TUInt Ptr (Ptr MutableTree) -> -- out_subdir : TInterface (Name {namespace = "OSTree", name = "MutableTree"}) Ptr (Ptr GError) -> -- error IO CInt {- | Traverse /@start@/ number of elements starting from /@splitPath@/; the child will be returned in /@outSubdir@/. -} mutableTreeWalk :: (B.CallStack.HasCallStack, MonadIO m, IsMutableTree a) => a {- ^ /@self@/: Tree -} -> [T.Text] {- ^ /@splitPath@/: Split pathname -} -> Word32 {- ^ /@start@/: Descend from this number of elements in /@splitPath@/ -} -> m (MutableTree) {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} mutableTreeWalk self splitPath start = liftIO $ do self' <- unsafeManagedPtrCastPtr self splitPath' <- mapM textToCString splitPath splitPath'' <- packGPtrArray splitPath' outSubdir <- allocMem :: IO (Ptr (Ptr MutableTree)) onException (do _ <- propagateGError $ ostree_mutable_tree_walk self' splitPath'' start outSubdir outSubdir' <- peek outSubdir outSubdir'' <- (wrapObject MutableTree) outSubdir' touchManagedPtr self mapPtrArray freeMem splitPath'' unrefPtrArray splitPath'' freeMem outSubdir return outSubdir'' ) (do mapPtrArray freeMem splitPath'' unrefPtrArray splitPath'' freeMem outSubdir ) #if ENABLE_OVERLOADING data MutableTreeWalkMethodInfo instance (signature ~ ([T.Text] -> Word32 -> m (MutableTree)), MonadIO m, IsMutableTree a) => O.MethodInfo MutableTreeWalkMethodInfo a signature where overloadedMethod _ = mutableTreeWalk #endif