public class LibZFS extends Object implements ZFSContainer
| Constructor and Description |
|---|
LibZFS() |
| Modifier and Type | Method and Description |
|---|---|
List<ZFSFileSystem> |
children()
List the children of this ZFS object (but not recursively.)
|
<T extends ZFSObject> |
children(Class<T> type)
List the specific kind of children of this ZFS object (but not recursively.)
|
<T extends ZFSObject> |
create(String dataSetName,
Class<T> type)
Create a ZFS Data Set of a given name and zfs type.
|
ZFSObject |
create(String dataSetName,
ZFSType type,
Map<String,String> props)
Create a ZFS Data Set of a given name, zfs type and properties.
|
List<ZFSObject> |
descendants()
List the children of this ZFS object recursively, excluding the 'this' object itself.
|
<T extends ZFSObject> |
descendants(Class<T> type) |
void |
dispose()
Eagerly releases the native resource associated with this wrapper,
instead of waiting for GC to take care of it.
|
boolean |
exists(String dataSetName)
Does a zfs dataset of the given name exist?
|
boolean |
exists(String name,
Set<ZFSType> typeMask)
Does a zfs dataset of the given name and the given types exist?
|
boolean |
exists(String dataSetName,
ZFSType type)
Does a zfs dataset of the given name and the given type exist?
|
protected void |
finalize() |
ZFSFileSystem |
getFileSystemByMountPoint(File dir)
Gets a
ZFSFileSystem mounted at the given directory. |
libzfs_handle_t |
getHandle()
Returns
libzfs_handle_t that this object wraps. |
ZFSPool |
getPool(String name)
Gets the pool of the given name.
|
ZFSObject |
open(String dataSetName)
Open a ZFS Data Set of a given name.
|
<T extends ZFSObject> |
open(String dataSetName,
Class<T> type)
Opens a ZFS dataset of the given name and type.
|
ZFSObject |
open(String dataSetName,
int mask)
Open a ZFS Data Set of a given name and type.
|
List<ZFSPool> |
pools()
Lists up all the ZFS pools.
|
List<ZFSFileSystem> |
roots()
List up all the root file systems and return them.
|
public List<ZFSFileSystem> roots()
In ZFS, each zpool gets a top-level zfs file system automatically. This method returns those top-level file systems.
public List<ZFSPool> pools()
public boolean exists(String dataSetName)
dataSetName - the dataset name of check for.public boolean exists(String name, Set<ZFSType> typeMask)
name - the dataset name of check for.typeMask - the specific zfs types to check for.public boolean exists(String dataSetName, ZFSType type)
dataSetName - the dataset name of check for.type - the specific zfs type to check for.public <T extends ZFSObject> T create(String dataSetName, Class<T> type)
dataSetName - name of the dataset to create.type - the zfs type of dataset to create.public ZFSObject create(String dataSetName, ZFSType type, Map<String,String> props)
dataSetName - Full name of the dataset to create, like "rpool/abc/def".type - the zfs type of dataset to create. Either ZFSType.FILESYSTEM or ZFSType.VOLUME.props - zfs dataset properties. Can be null.public ZFSObject open(String dataSetName)
dataSetName - name of the dataset to open.public ZFSObject open(String dataSetName, int mask)
dataSetName - name of the dataset to open.mask - the zfs type mask of dataset to open.public <T extends ZFSObject> T open(String dataSetName, Class<T> type)
public ZFSFileSystem getFileSystemByMountPoint(File dir)
ZFSFileSystem mounted at the given directory.public List<ZFSFileSystem> children()
ZFSContainerchildren in interface ZFSContainerpublic <T extends ZFSObject> List<T> children(Class<T> type)
ZFSContainerchildren in interface ZFSContainerpublic List<ZFSObject> descendants()
ZFSContainerdescendants in interface ZFSContainerpublic <T extends ZFSObject> List<T> descendants(Class<T> type)
descendants in interface ZFSContainerpublic libzfs_handle_t getHandle()
libzfs_handle_t that this object wraps.
If the caller wants to use methods that don't yet have a high-level
binding, the returned libzfs_handle_t can be used directly in
conjunction with libzfs.LIBZFS.
protected void finalize()
throws Throwable
public void dispose()
Copyright © 2008–2017. All rights reserved.