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


Python WalFileInfo.to_xlogdb_line方法代码示例

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


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

示例1: test_get_wal_until_next_backup

# 需要导入模块: from barman.infofile import WalFileInfo [as 别名]
# 或者: from barman.infofile.WalFileInfo import to_xlogdb_line [as 别名]
    def test_get_wal_until_next_backup(self, get_backup_mock, tmpdir):
        """
        Simple test for the management of .history files
        """
        # build a WalFileInfo object
        wfile_info = WalFileInfo()
        wfile_info.name = '000000010000000000000003'
        wfile_info.size = 42
        wfile_info.time = 43
        wfile_info.compression = None

        # build a WalFileInfo history object
        history_info = WalFileInfo()
        history_info.name = '00000001.history'
        history_info.size = 42
        history_info.time = 43
        history_info.compression = None

        # create a xlog.db and add the 2 entries
        wals_dir = tmpdir.mkdir("wals")
        xlog = wals_dir.join("xlog.db")
        xlog.write(wfile_info.to_xlogdb_line() + history_info.to_xlogdb_line())
        # fake backup
        backup = build_test_backup_info(
            begin_wal='000000010000000000000001',
            end_wal='000000010000000000000004')

        # mock a server object and mock a return call to get_next_backup method
        server = build_real_server(
            global_conf={
                "barman_lock_directory": tmpdir.mkdir('lock').strpath
            },
            main_conf={
                "wals_directory": wals_dir.strpath
            })
        get_backup_mock.return_value = build_test_backup_info(
            backup_id="1234567899",
            begin_wal='000000010000000000000005',
            end_wal='000000010000000000000009')

        wals = []
        for wal_file in server.get_wal_until_next_backup(backup,
                                                         include_history=True):
            # get the result of the xlogdb read
            wals.append(wal_file.name)
        # check for the presence of the .history file
        assert history_info.name in wals
开发者ID:moench-tegeder,项目名称:barman,代码行数:49,代码来源:test_server.py

示例2: test_to_xlogdb_line

# 需要导入模块: from barman.infofile import WalFileInfo [as 别名]
# 或者: from barman.infofile.WalFileInfo import to_xlogdb_line [as 别名]
    def test_to_xlogdb_line(self):
        wfile_info = WalFileInfo()
        wfile_info.name = '000000000000000000000002'
        wfile_info.size = 42
        wfile_info.time = 43
        wfile_info.compression = None
        assert wfile_info.relpath() == '0000000000000000/000000000000000000000002'

        assert wfile_info.to_xlogdb_line() == '000000000000000000000002\t42\t43\tNone\n'
开发者ID:zacchiro,项目名称:barman,代码行数:11,代码来源:test_infofile.py


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