{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.OSTree.Structs.RepoDevInoCache
    ( 

-- * Exported types
    RepoDevInoCache(..)                     ,
    noRepoDevInoCache                       ,


 -- * Methods
-- ** new #method:new#
    repoDevInoCacheNew                      ,


-- ** ref #method:ref#
    RepoDevInoCacheRefMethodInfo            ,
    repoDevInoCacheRef                      ,


-- ** unref #method:unref#
    RepoDevInoCacheUnrefMethodInfo          ,
    repoDevInoCacheUnref                    ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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


newtype RepoDevInoCache = RepoDevInoCache (ManagedPtr RepoDevInoCache)
foreign import ccall "ostree_repo_devino_cache_get_type" c_ostree_repo_devino_cache_get_type :: 
    IO GType

instance BoxedObject RepoDevInoCache where
    boxedType _ = c_ostree_repo_devino_cache_get_type

noRepoDevInoCache :: Maybe RepoDevInoCache
noRepoDevInoCache = Nothing


instance O.HasAttributeList RepoDevInoCache
type instance O.AttributeList RepoDevInoCache = RepoDevInoCacheAttributeList
type RepoDevInoCacheAttributeList = ('[ ] :: [(Symbol, *)])

-- method RepoDevInoCache::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"}))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_devino_cache_new" ostree_repo_devino_cache_new :: 
    IO (Ptr RepoDevInoCache)

{- |
OSTree has support for pairing @/ostree_repo_checkout_tree_at()/@ using
hardlinks in combination with a later
'GI.OSTree.Objects.Repo.repoWriteDirectoryToMtree' using a (normally modified)
directory.  In order for OSTree to optimally detect just the new
files, use this function and fill in the @devino_to_csum_cache@
member of @OstreeRepoCheckoutAtOptions@, then call
@/ostree_repo_commit_set_devino_cache()/@.
-}
repoDevInoCacheNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m RepoDevInoCache
    {- ^ __Returns:__ Newly allocated cache -}
repoDevInoCacheNew  = liftIO $ do
    result <- ostree_repo_devino_cache_new
    checkUnexpectedReturnNULL "repoDevInoCacheNew" result
    result' <- (wrapBoxed RepoDevInoCache) result
    return result'

-- method RepoDevInoCache::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "cache", argType = TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"}))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_devino_cache_ref" ostree_repo_devino_cache_ref :: 
    Ptr RepoDevInoCache ->                  -- cache : TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"})
    IO (Ptr RepoDevInoCache)

{- |
/No description available in the introspection data./
-}
repoDevInoCacheRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoDevInoCache
    -> m RepoDevInoCache
repoDevInoCacheRef cache = liftIO $ do
    cache' <- unsafeManagedPtrGetPtr cache
    result <- ostree_repo_devino_cache_ref cache'
    checkUnexpectedReturnNULL "repoDevInoCacheRef" result
    result' <- (wrapBoxed RepoDevInoCache) result
    touchManagedPtr cache
    return result'

data RepoDevInoCacheRefMethodInfo
instance (signature ~ (m RepoDevInoCache), MonadIO m) => O.MethodInfo RepoDevInoCacheRefMethodInfo RepoDevInoCache signature where
    overloadedMethod _ = repoDevInoCacheRef

-- method RepoDevInoCache::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "cache", argType = TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"}), 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_repo_devino_cache_unref" ostree_repo_devino_cache_unref :: 
    Ptr RepoDevInoCache ->                  -- cache : TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"})
    IO ()

{- |
/No description available in the introspection data./
-}
repoDevInoCacheUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoDevInoCache
    -> m ()
repoDevInoCacheUnref cache = liftIO $ do
    cache' <- unsafeManagedPtrGetPtr cache
    ostree_repo_devino_cache_unref cache'
    touchManagedPtr cache
    return ()

data RepoDevInoCacheUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo RepoDevInoCacheUnrefMethodInfo RepoDevInoCache signature where
    overloadedMethod _ = repoDevInoCacheUnref

type family ResolveRepoDevInoCacheMethod (t :: Symbol) (o :: *) :: * where
    ResolveRepoDevInoCacheMethod "ref" o = RepoDevInoCacheRefMethodInfo
    ResolveRepoDevInoCacheMethod "unref" o = RepoDevInoCacheUnrefMethodInfo
    ResolveRepoDevInoCacheMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveRepoDevInoCacheMethod t RepoDevInoCache, O.MethodInfo info RepoDevInoCache p) => O.IsLabelProxy t (RepoDevInoCache -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveRepoDevInoCacheMethod t RepoDevInoCache, O.MethodInfo info RepoDevInoCache p) => O.IsLabel t (RepoDevInoCache -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif