Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
def create(cluster, name, configuration):
    codec = TextCodec(ReplicationSetConfiguration)
    configuration = codec.decode(configuration.read())

    with cluster:
        return administration.create_set(cluster, name, configuration)
Exemplo n.º 4
0
def create(cluster, name, configuration):
    codec = TextCodec(ReplicationSetConfiguration)
    configuration = codec.decode(configuration.read())

    with cluster:
        return administration.create_set(cluster, name, configuration)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
def main(cluster, set, stream):
    return StreamWriter(stream, TextCodec(Message))
Exemplo n.º 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))