当前位置: 首页>>代码示例>>Python>>正文


Python CONFIG.unmap_bs方法代码示例

本文整理汇总了Python中CONFIG.unmap_bs方法的典型用法代码示例。如果您正苦于以下问题:Python CONFIG.unmap_bs方法的具体用法?Python CONFIG.unmap_bs怎么用?Python CONFIG.unmap_bs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CONFIG的用法示例。


在下文中一共展示了CONFIG.unmap_bs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_follow_on_empty

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def test_follow_on_empty(self):
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    CONFIG.BSARGS(self.bspath))

    # Follow should generate NotFound on empty BS.
    seed = (buffer(""), buffer(""))
    py.test.raises(utp.NotFoundError, self.bs.bs_head_follow, seed)

    # Follow should generate NotFound on empty BS, even w/ fsid
    seed = (buffer(""), buffer(""))
    py.test.raises(utp.NotFoundError, self.bs.bs_head_follow, seed)

    # Reopen the blockstore.
    self.bs.bs_close()
    self.bs = utp.BlockStore.open(CONFIG.BSTYPE,
                                  "rootbs",
                                  CONFIG.BSARGS(self.bspath))

    # Follow should generate NotFound on empty BS.
    seed = (buffer(""), buffer(""))
    py.test.raises(utp.NotFoundError, self.bs.bs_head_follow, seed)

    # Follow should generate NotFound on empty BS, even w/ fsid
    seed = (buffer("fsid"), buffer(""))
    py.test.raises(utp.NotFoundError, self.bs.bs_head_follow, seed)

    # Close the blockstore.
    self.bs.bs_close()
    CONFIG.remove_bs(self.bspath)
开发者ID:ksedgwic,项目名称:utopfs,代码行数:35,代码来源:test_bs_head_01.py

示例2: test_symlink

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def test_symlink(self):

    # Remove any prexisting blockstore.
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)

    # Create the filesystem
    bsargs = CONFIG.BSARGS(self.bspath)
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    bsargs)
    self.fs = utp.FileSystem.mkfs(CONFIG.FSTYPE, self.bs, "", "",
                                  CONFIG.UNAME, CONFIG.GNAME, CONFIG.FSARGS)

    # Create a directory.
    self.fs.fs_mkdir("/foo", 0555, CONFIG.UNAME, CONFIG.GNAME)

    # Create a file.
    self.fs.fs_mknod("/foo/bar", 0666, 0, CONFIG.UNAME, CONFIG.GNAME)

    # Open the file.
    self.fs.fs_open("/foo/bar", O_RDWR)

    # Write some bytes into the file.
    self.fs.fs_write("/foo/bar", buffer("testdata"))

    # Check clash w/ existing file.
    try:
      self.fs.fs_symlink("/blahblah", "/foo/bar");
      assert False
    except OSError, ex:
      assert ex.errno == EEXIST
开发者ID:ksedgwic,项目名称:utopfs,代码行数:35,代码来源:test_fs_symlink_01.py

示例3: test_rmdir

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def test_rmdir(self):

    # Remove any prexisting blockstore.
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)

    # Create the filesystem
    bsargs = CONFIG.BSARGS(self.bspath)
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    bsargs)
    self.fs = utp.FileSystem.mkfs(CONFIG.FSTYPE, self.bs, "", "",
                                  CONFIG.UNAME, CONFIG.GNAME, CONFIG.FSARGS)

    # Create a file.
    self.fs.fs_mknod("/bar", 0666, 0, CONFIG.UNAME, CONFIG.GNAME)

    # Create a directory.
    self.fs.fs_mkdir("/foo", 0555, CONFIG.UNAME, CONFIG.GNAME)

    # Now we should be able to stat the file.
    st = self.fs.fs_getattr("/bar");

    # Now we should be able to stat the dir.
    st = self.fs.fs_getattr("/foo");

    # Shouldn't be able to rmdir the file.
    try:
      self.fs.fs_rmdir("/bar");
      assert False
    except OSError, ex:
      assert ex.errno == ENOTDIR
开发者ID:ksedgwic,项目名称:utopfs,代码行数:35,代码来源:test_fs_rmdir_01.py

示例4: test_rmdir_nonempty

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def test_rmdir_nonempty(self):

    # Remove any prexisting blockstore.
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)

    # Create the filesystem
    bsargs = CONFIG.BSARGS(self.bspath)
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    bsargs)
    self.fs = utp.FileSystem.mkfs(CONFIG.FSTYPE, self.bs, "", "",
                                  CONFIG.UNAME, CONFIG.GNAME, CONFIG.FSARGS)

    # Create a directory.
    self.fs.fs_mkdir("/top", 0555, CONFIG.UNAME, CONFIG.GNAME)

    # Create a file.
    self.fs.fs_mknod("/top/inside", 0666, 0, CONFIG.UNAME, CONFIG.GNAME)

    # Shouldn't be able to rmdir the directory.
    try:
      self.fs.fs_rmdir("/top");
      assert False
    except OSError, ex:
      assert ex.errno == ENOTEMPTY
开发者ID:ksedgwic,项目名称:utopfs,代码行数:29,代码来源:test_fs_rmdir_01.py

示例5: test_furthest_on_single

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def test_furthest_on_single(self):
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    CONFIG.BSARGS(self.bspath))

    # Insert a single SHE.
    node = utp.SignedHeadEdge(("fsid", "rootref", 0, time.time() * 1e6, 0, 0))
    self.bs.bs_head_insert(node)

    # Furthest should return the node we inserted.
    seed = (buffer("fsid"), buffer(""))
    shes = self.bs.bs_head_furthest(seed)
    assert lenhack(shes) == 1
    assert shes[0] == (buffer("fsid"), buffer("rootref"))

    # Reopen the blockstore.
    self.bs.bs_close()
    self.bs = utp.BlockStore.open(CONFIG.BSTYPE,
                                  "rootbs",
                                  CONFIG.BSARGS(self.bspath))

    # Furthest should return the node we inserted.
    seed = (buffer("fsid"), buffer(""))
    shes = self.bs.bs_head_furthest(seed)
    assert lenhack(shes) == 1
    assert shes[0] == (buffer("fsid"), buffer("rootref"))

    # Close the blockstore.
    self.bs.bs_close()
    CONFIG.remove_bs(self.bspath)
开发者ID:ksedgwic,项目名称:utopfs,代码行数:35,代码来源:test_bs_head_01.py

示例6: test_unlink

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def test_unlink(self):

    print "Remove any prexisting blockstore."
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)

    print "Create the filesystem"
    bsargs = CONFIG.BSARGS(self.bspath)
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    bsargs)
    self.fs = utp.FileSystem.mkfs(CONFIG.FSTYPE, self.bs, "", "",
                                  CONFIG.UNAME, CONFIG.GNAME, CONFIG.FSARGS)

    print "Create a file"
    self.fs.fs_mknod("/bar", 0666, 0, CONFIG.UNAME, CONFIG.GNAME)

    print "Create a directory"
    self.fs.fs_mkdir("/foo", 0555, CONFIG.UNAME, CONFIG.GNAME)

    print "Now we should be able to stat the file."
    st = self.fs.fs_getattr("/bar");

    print "Now we should be able to stat the dir."
    st = self.fs.fs_getattr("/foo");

    print "Shouldn't be able to unlink the directory."
    try:
      self.fs.fs_unlink("/foo");
      assert False
    except OSError, ex:
      assert ex.errno == EISDIR

      print "Should be able to unlink the file."
开发者ID:ksedgwic,项目名称:utopfs,代码行数:37,代码来源:test_fs_unlink_01.py

示例7: setup_class

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def setup_class(self):
    self.bspath = "fs_getattr_01.bs"

    # Remove any prexisting blockstore.
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)

    # Create the filesystem
    bsargs = CONFIG.BSARGS(self.bspath)
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    bsargs)
    self.fs = utp.FileSystem.mkfs(CONFIG.FSTYPE, self.bs, "", "",
                                  CONFIG.UNAME, CONFIG.GNAME, CONFIG.FSARGS)

    # Make a directory.
    self.fs.fs_mkdir("/foo", 0755, CONFIG.UNAME, CONFIG.GNAME)

    # Make a file.
    self.fs.fs_mknod("/foo/bar", 0666, 0, CONFIG.UNAME, CONFIG.GNAME)

    
	
    # Now we unmount the filesystem.
    self.fs.fs_umount()
    self.bs.bs_close()
    
    # Now mount it again.
    bsargs = CONFIG.BSARGS(self.bspath)
    self.bs = utp.BlockStore.open(CONFIG.BSTYPE, "rootbs", bsargs)
    self.fs = utp.FileSystem.mount(CONFIG.FSTYPE, self.bs,
                                   "", "", CONFIG.FSARGS)
开发者ID:ksedgwic,项目名称:utopfs,代码行数:35,代码来源:test_fs_getattr_02.py

示例8: test_furthest_on_single_w_miss

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def test_furthest_on_single_w_miss(self):
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    CONFIG.BSARGS(self.bspath))

    # Insert a single SHE.
    node = utp.SignedHeadEdge(("fsid", "rootref", 0, time.time() * 1e6, 0, 0))
    self.bs.bs_head_insert(node)

    # Furthest should miss w/ bad key.
    miss = (buffer("fsid"), buffer("notref"))
    shes = self.bs.bs_head_furthest(miss)
    assert lenhack(shes) == 0

    # Reopen the blockstore.
    self.bs.bs_close()
    self.bs = utp.BlockStore.open(CONFIG.BSTYPE,
                                  "rootbs",
                                  CONFIG.BSARGS(self.bspath))

    # Furthest should miss w/ bad key.
    miss = (buffer("fsid"), buffer("notref"))
    shes = self.bs.bs_head_furthest(miss)
    assert lenhack(shes) == 0

    # Close the blockstore.
    self.bs.bs_close()
    CONFIG.remove_bs(self.bspath)
开发者ID:ksedgwic,项目名称:utopfs,代码行数:33,代码来源:test_bs_head_01.py

示例9: test_follow_on_single_w_miss

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def test_follow_on_single_w_miss(self):
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    CONFIG.BSARGS(self.bspath))

    # Insert a single SHE.
    node = utp.SignedHeadEdge(("fsid", "rootref", 0, time.time() * 1e6, 0, 0))
    self.bs.bs_head_insert(node)

    # Follow should miss w/ bad key.
    miss = (buffer("fsid"), buffer("notref"))
    py.test.raises(utp.NotFoundError, self.bs.bs_head_follow, miss)

    # Reopen the blockstore.
    self.bs.bs_close()
    self.bs = utp.BlockStore.open(CONFIG.BSTYPE,
                                  "rootbs",
                                  CONFIG.BSARGS(self.bspath))

    # Follow should miss w/ bad key.
    miss = (buffer("fsid"), buffer("notref"))
    py.test.raises(utp.NotFoundError, self.bs.bs_head_follow, miss)

    # Close the blockstore.
    self.bs.bs_close()
    CONFIG.remove_bs(self.bspath)
开发者ID:ksedgwic,项目名称:utopfs,代码行数:31,代码来源:test_bs_head_01.py

示例10: setup_class

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
 def setup_class(self):
   self.bspath = "bs_refresh_01"
   CONFIG.unmap_bs("rootbs")
   CONFIG.remove_bs(self.bspath)
   self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                   "rootbs",
                                   CONFIG.BSSIZE,
                                   CONFIG.BSARGS(self.bspath))
开发者ID:ksedgwic,项目名称:utopfs,代码行数:10,代码来源:test_bs_refresh_01.py

示例11: test_read

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
    def test_read(self):

        # Remove any prexisting blockstore.
        CONFIG.unmap_bs("rootbs")
        CONFIG.remove_bs(self.bspath)

        # Create the filesystem
        bsargs = CONFIG.BSARGS(self.bspath)
        self.bs = utp.BlockStore.create(CONFIG.BSTYPE, "rootbs", CONFIG.BSSIZE, bsargs)
        self.fs = utp.FileSystem.mkfs(CONFIG.FSTYPE, self.bs, "", "", CONFIG.UNAME, CONFIG.GNAME, CONFIG.FSARGS)

        # Create a file.
        self.fs.fs_mknod("/foo", 0666, 0, CONFIG.UNAME, CONFIG.GNAME)

        # Write some data into the file.
        self.fs.fs_write("/foo", buffer("testdata"))

        # Now we should be able to stat the file.
        st = self.fs.fs_getattr("/foo")
        assert S_ISREG(st[ST_MODE])
        assert st[ST_SIZE] == 8

        # Now try and read 4096 bytes.
        buf = self.fs.fs_read("/foo", 4096)
        assert str(buf) == "testdata"

        # Now try and read 4097 bytes.
        buf = self.fs.fs_read("/foo", 4097)
        assert str(buf) == "testdata"

        # Now we unmount the filesystem.
        self.fs.fs_umount()
        self.bs.bs_close()

        # Now mount it again.
        bsargs = CONFIG.BSARGS(self.bspath)
        self.bs = utp.BlockStore.open(CONFIG.BSTYPE, "rootbs", bsargs)
        self.fs = utp.FileSystem.mount(CONFIG.FSTYPE, self.bs, "", "", CONFIG.FSARGS)

        # We should be able to stat the same file.
        st = self.fs.fs_getattr("/foo")
        assert S_ISREG(st[ST_MODE])
        assert st[ST_SIZE] == 8

        # We should be able to read the data.
        self.fs.fs_open("/foo", O_RDONLY)
        buf = self.fs.fs_read("/foo", 4096)
        assert str(buf) == "testdata"

        # We should be able to read the data.
        self.fs.fs_open("/foo", O_RDONLY)
        buf = self.fs.fs_read("/foo", 4097)
        assert str(buf) == "testdata"

        # WORKAROUND - py.test doesn't correctly capture the DTOR logging.
        self.bs.bs_close()
        self.bs = None
        self.fs = None
开发者ID:ksedgwic,项目名称:utopfs,代码行数:60,代码来源:test_fs_read_01.py

示例12: test_create

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
 def test_create(self):    
   CONFIG.unmap_bs("rootbs")
   CONFIG.remove_bs(self.bspath)
   bs = utp.BlockStore.create(CONFIG.BSTYPE,
                              "rootbs",
                              CONFIG.BSSIZE,
                              CONFIG.BSARGS(self.bspath))
   bs.bs_close()
   CONFIG.remove_bs(self.bspath)
开发者ID:ksedgwic,项目名称:utopfs,代码行数:11,代码来源:test_bs_unopened.py

示例13: teardown_class

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def teardown_class(self):
    # WORKAROUND - py.test doesn't correctly capture the DTOR logging.
    self.bs.bs_close()
    olvl = utp.FileSystem.loglevel(-1)
    self.bs = None
    self.fs = None
    utp.FileSystem.loglevel(olvl)

    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)
开发者ID:ksedgwic,项目名称:utopfs,代码行数:12,代码来源:test_fs_getattr_02.py

示例14: setup_class

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
    def setup_class(self):
        self.bspath = "fs_rename_01.bs"

        # Remove any prexisting blockstore.
        CONFIG.unmap_bs("rootbs")
        CONFIG.remove_bs(self.bspath)

        # Create the filesystem
        bsargs = CONFIG.BSARGS(self.bspath)
        self.bs = utp.BlockStore.create(CONFIG.BSTYPE, "rootbs", CONFIG.BSSIZE, bsargs)
        self.fs = utp.FileSystem.mkfs(CONFIG.FSTYPE, self.bs, "", "", CONFIG.UNAME, CONFIG.GNAME, CONFIG.FSARGS)
开发者ID:ksedgwic,项目名称:utopfs,代码行数:13,代码来源:test_fs_rename_01.py

示例15: test_bs_stat

# 需要导入模块: import CONFIG [as 别名]
# 或者: from CONFIG import unmap_bs [as 别名]
  def test_bs_stat(self):
    # In case it already exists ...
    CONFIG.unmap_bs("rootbs")
    CONFIG.remove_bs(self.bspath)

    # Create the blockstore.
    self.bs = utp.BlockStore.create(CONFIG.BSTYPE,
                                    "rootbs",
                                    CONFIG.BSSIZE,
                                    CONFIG.BSARGS(self.bspath))

    # Check the blockstore stats.
    bss = self.bs.bs_stat();
    assert bss.bss_size == CONFIG.BSSIZE
    assert bss.bss_free == CONFIG.BSSIZE

    # Check that it looks like a tuple too.
    assert bss == (CONFIG.BSSIZE, CONFIG.BSSIZE)

    # Use some bytes.
    k = buffer("samplekey")
    v = buffer("sampledata")
    self.bs.bs_block_put(k, v)

    # Check the blockstore stats.
    bss = self.bs.bs_stat();
    assert bss.bss_size == CONFIG.BSSIZE
    assert bss.bss_free == CONFIG.BSSIZE - 10

    # Use some more bytes.
    k = buffer("samplekey2")
    v = buffer("sampledata2")
    self.bs.bs_block_put(k, v)

    # Check the blockstore stats.
    bss = self.bs.bs_stat();
    assert bss.bss_size == CONFIG.BSSIZE
    assert bss.bss_free == CONFIG.BSSIZE - 21

    # Close and reopen the blockstore.
    self.bs.bs_close()
    self.bs = utp.BlockStore.open(CONFIG.BSTYPE,
                                  "rootbs",
                                  CONFIG.BSARGS(self.bspath))

    # Check the blockstore stats.
    bss = self.bs.bs_stat();
    assert bss.bss_size == CONFIG.BSSIZE
    assert bss.bss_free == CONFIG.BSSIZE - 21

    # Close the blockstore.
    self.bs.bs_close()
    CONFIG.remove_bs(self.bspath)
开发者ID:ksedgwic,项目名称:utopfs,代码行数:55,代码来源:test_bs_size_01.py


注:本文中的CONFIG.unmap_bs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。