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)
def create(cluster, name, configuration): codec = TextCodec(ReplicationSetConfiguration) configuration = codec.decode(configuration.read()) with cluster: return administration.create_set(cluster, name, configuration)
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)
def main(cluster, set, stream): return StreamWriter(stream, TextCodec(Message))
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))