gpt4 book ai didi

org.jvnet.solaris.libzfs.ZFSObject类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:32:28 30 4
gpt4 key购买 nike

本文整理了Java中org.jvnet.solaris.libzfs.ZFSObject类的一些代码示例,展示了ZFSObject类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZFSObject类的具体详情如下:
包路径:org.jvnet.solaris.libzfs.ZFSObject
类名称:ZFSObject

ZFSObject介绍

[英]Represents ZFS snapshot, file system, volume, or pool.
[中]表示ZFS快照、文件系统、卷或池。

代码示例

代码示例来源:origin: org.jvnet.libzfs/libzfs

public List<ZFSObject> descendants() {
  return children(ZFSObject.class);
}

代码示例来源:origin: org.jvnet.libzfs/libzfs

public int callback(zfs_handle_t handle, Pointer arg) {
    set.add((ZFSSnapshot)ZFSObject.create(library, handle));
    return 0;
  }
}, null);

代码示例来源:origin: org.jvnet.libzfs/libzfs

/**
 * Take a snapshot of this ZFS dataset.
 * 
 * @param snapshotName
 *            the name of the Snapshot to create, i.e. 'monday',
 *            'before-test'.
 * @return the created snapshot.
 */
public ZFSSnapshot createSnapshot(final String snapshotName) {
  final ZFSSnapshot dataSet = createSnapshot(snapshotName, false);
  return dataSet;
}

代码示例来源:origin: org.jvnet.libzfs/libzfs

/**
 * Wipes out this dataset and all its data, optionally recursively.
 */
public void destory(boolean recursive) {
  if(recursive) {
    for (ZFSObject child : children())
      child.destory(recursive);
  }
  destory();
}

代码示例来源:origin: org.kohsuke/libzfs

/**
 * Wipes out this dataset and all its data, optionally recursively.
 */
public void destroy(boolean recursive) {
  if(recursive) {
    for (ZFSObject child : children())
      child.destroy(recursive);
  }
  destroy();
}

代码示例来源:origin: org.kohsuke/libzfs

/**
 * Recursively destroy a named snapshot of this dataset and its descendants.
 */
public void destroySnapshot(String name, boolean recursive) {
  if (recursive) {
    for (ZFSObject child : children())
      child.destroySnapshot(name, true);
  }
  destroySnapshot(name);
}

代码示例来源:origin: org.jvnet.libzfs/libzfs

private <T extends ZFSObject> List<T> children(Class<T> type, List<T> list, boolean recursive) {
  for (ZFSObject snap : snapshots()) {
    if(type.isInstance(snap))
      list.add(type.cast(snap));
  }
  for (ZFSObject child : getChildren()) {
    if (!child.getName().contains("@")) {
      if(type.isInstance(child))
        list.add(type.cast(child));
      if(recursive)
        child.children(type,list,recursive);
    }
  }
  return list;
}

代码示例来源:origin: org.jvnet.libzfs/libzfs

public ZFSObject rollback(boolean recursive) {
  String filesystem = name.substring(0, getName().indexOf("@"));
  ZFSObject fs = library.open(filesystem);
  if (recursive) {
    /* first pass - check for clones */
    List<ZFSObject> list = fs.getChildren();
    for (ZFSObject child : list) {
      if (!child.getName().startsWith(filesystem + "@")) {
        return child;
      }
    }
    /* second pass - find snapshot index, destroy later snapshots */
    boolean found = false;
    for (ZFSObject snap : fs.snapshots()) {
      String name = snap.getName();
      if (name.equals(getName())) {
        found = true;
        continue;
      }
      if (found) {
        snap.destory();
      }
    }
  }
  if (LIBZFS.zfs_rollback(fs.handle, handle, recursive) != 0)
    throw new ZFSException(library);
  return library.open(filesystem);
}

代码示例来源:origin: org.jvnet.libzfs/libzfs

/**
   * Returns {@link #getName() the name}.
   */
  @Override
  public String toString() {
    return getName();
  }
}

代码示例来源:origin: org.kohsuke/libzfs

@Override
protected void finalize() throws Throwable {
  dispose();
  super.finalize();
}

代码示例来源:origin: org.jvnet.libzfs/libzfs

public int compareTo(ZFSObject that) {
  long a = Long.parseLong(this.getZfsProperty(zfs_prop_t.ZFS_PROP_CREATETXG));
  long b = Long.parseLong(that.getZfsProperty(zfs_prop_t.ZFS_PROP_CREATETXG));
  if (a > b) {
    return 1;
  }
  if (a < b) {
    return -1;
  }
  return 0;
}

代码示例来源:origin: org.kohsuke/libzfs

/**
 * @deprecated added by typo
 */
public void destory(boolean recursive) {
  destroy(recursive);
}

代码示例来源:origin: org.kohsuke/libzfs

private <T extends ZFSObject> List<T> children(Class<T> type, List<T> list, boolean recursive) {
  for (ZFSObject snap : snapshots()) {
    if(type.isInstance(snap))
      list.add(type.cast(snap));
  }
  for (ZFSObject child : getChildren()) {
    if (!child.getName().contains("@")) {
      if(type.isInstance(child))
        list.add(type.cast(child));
      if(recursive)
        child.children(type,list,recursive);
    }
  }
  return list;
}

代码示例来源:origin: org.kohsuke/libzfs

public ZFSObject rollback(boolean recursive) {
  String filesystem = name.substring(0, getName().indexOf("@"));
  ZFSObject fs = library.open(filesystem);
  if (recursive) {
    /* first pass - check for clones */
    List<ZFSObject> list = fs.getChildren();
    for (ZFSObject child : list) {
      if (!child.getName().startsWith(filesystem + "@")) {
        return child;
      }
    }
    /* second pass - find snapshot index, destroy later snapshots */
    boolean found = false;
    for (ZFSObject snap : fs.snapshots()) {
      String name = snap.getName();
      if (name.equals(getName())) {
        found = true;
        continue;
      }
      if (found) {
        snap.destory();
      }
    }
  }
  if (LIBZFS.zfs_rollback(fs.handle, handle, recursive) != 0)
    throw new ZFSException(library);
  return library.open(filesystem);
}

代码示例来源:origin: org.kohsuke/libzfs

/**
 * Returns {@link #getName() the name}.
 */
@Override
public String toString() {
  return getName();
}

代码示例来源:origin: org.jvnet.libzfs/libzfs

@Override
protected void finalize() throws Throwable {
  dispose();
  super.finalize();
}

代码示例来源:origin: org.kohsuke/libzfs

public int compareTo(ZFSObject that) {
  long a = Long.parseLong(this.getZfsProperty(zfs_prop_t.ZFS_PROP_CREATETXG));
  long b = Long.parseLong(that.getZfsProperty(zfs_prop_t.ZFS_PROP_CREATETXG));
  if (a > b) {
    return 1;
  }
  if (a < b) {
    return -1;
  }
  return 0;
}

代码示例来源:origin: org.kohsuke/libzfs

/**
 * @deprecated added by typo
 */
public void destory() {
  destroy();
}

代码示例来源:origin: org.jvnet.libzfs/libzfs

/**
 * Creates a nested file system.
 *
 * @param props
 *      ZFS properties to be attached to the new file system. Can be null.
 */
public ZFSFileSystem createFileSystem(final String name, final Map<String, String> props) {
  return (ZFSFileSystem) library.create(getName()+'/'+name, ZFSType.FILESYSTEM,props);
}

代码示例来源:origin: org.jvnet.libzfs/libzfs

public int callback(zfs_handle_t handle, Pointer arg) {
    r.add(ZFSObject.create(library, handle));
    return 0;
  }
}, null);

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com