Skip to main content

#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...");

Release files for pycavedb 1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycavedb 1.3
File Size Uploaded
pycavedb-1.3.tar.gz 140.6 kB Details

Release files / pycavedb-1.3.tar.gz

Download URL pycavedb-1.3.tar.gz
Size 140.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ee54c24e6d2f0e1a85016094594e7d6770dd0a8ae83efd7d12e788851964da16
BLAKE2b-256 checksum
How to use checksums
1e6410c26463d580c48f5eeb245a4027233475ba870d2501c9109562eb25e9df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.3 This release

1 release file

1.2

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page