cavedb-python
Project description
#cavedb 这是一个实现了ssdb和redis同步协议的同步工具,它可以从ssdb或redis同步数据。
#pycavedb示例 1.创建对象继承于cavedb.cavedb。 2.调用其 slaveof_redis/slaveof_ssdb方法,从redis/ssdb同步数据,其中last_replid和last_offset表示同步进度,从覆盖的notify_psync/notify_command/notify_idle方法中可以获取同步进度。 3.在同步时,cavedb会插入几个特殊的同步命令,实际使用时需过滤掉它们,这几个命令分别为
命令 | 含义 |
---|---|
sync_start | 开始同步 |
sync_continue | 己同步完全量部分,开始同步增量部分 |
#! /usr/bin/python
#coding:utf-8
import cavedb
import time
class cavedb_impl(cavedb.cavedb):
def notify_psync(self,replid,offset):
return True;
def notify_idle(self,replid,offset):
return True;
def notify_command(self,replid,offset,args):
print args
if len(args) > 0 and args[0] in ["sync_start","sync_overflow","sync_continue"]:
return True;
return True;
cavedb_instance = cavedb_impl();
last_offset = 0;
last_replid = "";
cavedb_instance.slaveof_redis("127.0.0.1",6379,"",last_replid,last_offset);
while True:
time.sleep(1);
print("cavedb running...");
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycavedb-1.3.tar.gz
(140.6 kB
view details)
File details
Details for the file pycavedb-1.3.tar.gz
.
File metadata
- Download URL: pycavedb-1.3.tar.gz
- Upload date:
- Size: 140.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee54c24e6d2f0e1a85016094594e7d6770dd0a8ae83efd7d12e788851964da16 |
|
MD5 | 8ad353d3bab977022b13a9931f2f3d9c |
|
BLAKE2b-256 | 1e6410c26463d580c48f5eeb245a4027233475ba870d2501c9109562eb25e9df |