コード例 #1
0
ファイル: cli.py プロジェクト: fuziontech/pgshovel
def update(cluster, name, configuration):
    codec = TextCodec(ReplicationSetConfiguration)
    configuration = codec.decode(configuration.read())

    # TODO: Support forced removal again.
    with cluster:
        return administration.update_set(cluster, name, configuration)
コード例 #2
0
ファイル: __main__.py プロジェクト: disqus/pgshovel
def update(cluster, name, configuration):
    codec = TextCodec(ReplicationSetConfiguration)
    configuration = codec.decode(configuration.read())

    # TODO: Support forced removal again.
    with cluster:
        return administration.update_set(cluster, name, configuration)
コード例 #3
0
ファイル: __main__.py プロジェクト: disqus/pgshovel
def create(cluster, name, configuration):
    codec = TextCodec(ReplicationSetConfiguration)
    configuration = codec.decode(configuration.read())

    with cluster:
        return administration.create_set(cluster, name, configuration)
コード例 #4
0
ファイル: cli.py プロジェクト: fuziontech/pgshovel
def create(cluster, name, configuration):
    codec = TextCodec(ReplicationSetConfiguration)
    configuration = codec.decode(configuration.read())

    with cluster:
        return administration.create_set(cluster, name, configuration)
コード例 #5
0
ファイル: cli.py プロジェクト: fuziontech/pgshovel
def inspect(cluster, name):
    with cluster:
        data, stat = cluster.zookeeper.get(cluster.get_set_path(name))
        configuration = BinaryCodec(ReplicationSetConfiguration).decode(data)
        click.echo(TextCodec(ReplicationSetConfiguration).encode(configuration))
        click.echo('version: %s' % (administration.get_version(configuration)), err=True)
コード例 #6
0
def main(cluster, set, stream):
    return StreamWriter(stream, TextCodec(Message))
コード例 #7
0
    DatabaseConfiguration,
    TableConfiguration,
    ReplicationSetConfiguration,
)
from pgshovel.utilities.protobuf import TextCodec

dsn = sys.argv[1]

configuration = ReplicationSetConfiguration(
    database=DatabaseConfiguration(dsn=dsn),
    tables=[
        TableConfiguration(
            name='pgbench_accounts',
            primary_keys=['aid'],
            schema='public',
        ),
        TableConfiguration(
            name='pgbench_branches',
            primary_keys=['bid'],
            schema='public',
        ),
        TableConfiguration(
            name='pgbench_tellers',
            primary_keys=['tid'],
            schema='public',
        ),
    ],
)

sys.stdout.write(TextCodec(ReplicationSetConfiguration).encode(configuration))