frost373 / kitdb Goto Github PK
View Code? Open in Web Editor NEWKitDB是一个内嵌式持久型的 高速NoSQL存储 lib
Home Page: http://thinkin.top/
License: Apache License 2.0
KitDB是一个内嵌式持久型的 高速NoSQL存储 lib
Home Page: http://thinkin.top/
License: Apache License 2.0
好像在Win下,路径会有错误,我的DB路径是:C:\my\cat\kitdb
Caused by: top.thinkin.lightd.exception.KitDBException: STROE_ERROR
at top.thinkin.lightd.db.DB.buildTransactionDB(DB.java:330) ~[store-0.1.2.jar:na]
at top.thinkin.delayhunter.DelayhunterApplication.db(DelayhunterApplication.java:58) [classes/:na]
at top.thinkin.delayhunter.DelayhunterApplication$$EnhancerBySpringCGLIB$$d3b2e4f8.CGLIB$db$0(<generated>) ~[classes/:na]
at top.thinkin.delayhunter.DelayhunterApplication$$EnhancerBySpringCGLIB$$d3b2e4f8$$FastClassBySpringCGLIB$$8f5b371.invoke(<generated>) ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at top.thinkin.delayhunter.DelayhunterApplication$$EnhancerBySpringCGLIB$$d3b2e4f8.db(<generated>) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
... 38 common frames omitted
aftdb2: ÎļþÃû¡¢Ŀ¼Ãû»ò¾í±êÓ�
at org.rocksdb.TransactionDB.open(Native Method) ~[rocksdbjni-5.18.3.jar:na]
at org.rocksdb.TransactionDB.open(TransactionDB.java:90) ~[rocksdbjni-5.18.3.jar:na]
at top.thinkin.lightd.db.DB.buildTransactionDB(DB.java:324) ~[store-0.1.2.jar:na]
... 49 common frames omitted
[RMap.Entry(key=totalshare, value=[54, 52, 46, 49, 51]), RMap.Entry(key=ashare, value=[54, 52, 46, 49, 51]), RMap.Entry(key=totalassets, value=[48, 46, 48, 48]), RMap.Entry(key=startdate, value=[48])]
top.thinkin.lightd.exception.KitDBException: REPEATED_KEY Repeated keys
private void putMayTTL(String key, int ttl, Entry... entries) throws KitDBException {
checkTxStart();
try (CloseLock ignored = checkClose()) {
byte[] key_b = getKey(key);
DAssert.notEmpty(entries, ErrorType.EMPTY, "entries is empty");
byte[][] bytess = new byte[entries.length][];
for (int i = 0; i < entries.length; i++) {
bytess[i] = entries[i].value;
}
DAssert.isTrue(ArrayKits.noRepeate(bytess), ErrorType.REPEATED_KEY, "Repeated keys");
LockEntity lockEntity = lock(key);
能加微信交流下嘛?
zhugezifang001
对你们的项目表示赞赏。
不知道你们是否做过操作系统的普适性测试,目前我在一台 win7 和winserver 2016 上测试都无法使用
1:size方法需要修改下,如果key不存在,会抛null,最好返回0;
不然每次都得判断isExist().谢谢!
或者新增方法: sizeWithoutCheck()
2:zset增加range通过offset index获取,参考redis zset range. (默认的是score升序)
方便通过offset index,在不知道score范围时,获取range.
(现在只能自定义index设置到score,像list使用了。)
Sequence 的incr 里面建议换成BigDecimal 这样可以支持几乎无限位自增
public class Sequence {
public final static String HEAD = KeyEnum.SEQ.getKey();
private final static byte[] HEAD_B = HEAD.getBytes();
private final byte[] key_b;
private DB db;
private BigDecimal version;
public synchronized String incr(String increments) throws RocksDBException {
BigDecimal increment = new BigDecimal(increments);
if (version == null) {
byte[] value = db.rocksDB().get(key_b);
if (value == null) {
version = BigDecimal.ZERO;
} else {
version = new BigDecimal(ArrayKits.bytesToString(value));
}
}
version = version.add(increment);
db.rocksDB().put(key_b, ArrayKits.convertStringToBytes(version.toPlainString()));
return version.toPlainString();
}
public String get() {
return version.toPlainString();
}
public Sequence(DB db, byte[] key) {
this.db = db;
this.key_b = ArrayKits.addAll(HEAD_B, key);
}
}
类似地
万分感谢!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.