matehat / objective-leveldb Goto Github PK
View Code? Open in Web Editor NEWAn Objective-C database library built over Google's LevelDB
Home Page: http://matehat.github.io/Objective-LevelDB
License: MIT License
An Objective-C database library built over Google's LevelDB
Home Page: http://matehat.github.io/Objective-LevelDB
License: MIT License
Are you serious, next update version requires iOS 7.0?
By using pod 'Objective-LevelDB', :git => 'https://github.com/matehat/Objective-LevelDB.git'
, I got an error shows below when running pod update
,
[!] The platform of the target `Pods` (iOS 6.0) is not compatible with `leveldb (1.17.1)` which has a minimum requirement of iOS 7.0 - OS X 10.7.
I don't think leveldb
needs iOS 7 APIs.
This issue should be well fixed.
so we don't have to do it manually.
s.library = 'c++'
The dbName is ignored and LevelDB treats the path as a place to store file.
Thus when delete db,the whole path is deleted
"IO error: /var/mobile/Containers/Data/Application/B8C7E31C-AE41-4C00-AA807458AFA6024E/Documents/ShareStore/DataBase/CURRENT: Operation not permitted"
Errors encountered when opening the database,Is there any solution?
Another pod in my project also decided to use Common.h as a file name which caused the compilation to fail when only one of the files was used.
What are your thoughts on adding TTL to this project? I'm using this in my own app and have something I could merge upstream in the next few weeks.
I think adding a timeout on keys would be a huge feature, and while a little high level imo, fits the scope of this library. What do you think?
Backward prefixed enumerations with starting key is not working
[<CGUserDataModel 0x280304ff0> setNilValueForKey]: could not set nil as the value for the key sex111
adding attributes dynamically, reloading stored data, and reporting program errors
Here is an example of the fully parametrized enumeration API:
- (void) enumerateKeysAndObjectsBackward:(BOOL)backward
lazily:(BOOL)lazily
startingAtKey:(id)key
filteredByPredicate:(NSPredicate *)predicate
andPrefix:(id)prefix
usingBlock:(id)block;
The startingAtKey
and prefix
parameters can both be used to offset the starting key used in enumerating a leveldb instance. Their semantic is different though: prefix also restricts the end of the enumeration, so that the enumerated keys always contain the prefix, while startingKey only restricts the key where the enumeration begins.
In the current behavior, if a prefix is provided, the starting key is ignored. This is shouldn't be the case if the starting key honors the prefix restriction. In that case, it should be possible to specify where, in the prefixed region to start enumeration.
As someone else already mentioned in one of the other issues, LevelDB.mm seems to be missing some retains. I was getting unexplainable crashes for about 0.3% of my users and it turns out that the db ivar in LevelDB.mm is getting released even though a strong reference to its parent , and in turn itself exists when used across a multitude of threads with a very high volume of reads. Ironically, the issue gets worse when writes are synced on the wrapper.
The issue does get resolved when I move the three .mm files to ARC - which I thought would be easier to do than further debug the overrelease. Maybe the .mm files should just be moved to arc for good?
allKeys method not works, it returned before enumerating, it's already empty array!
Hi,
Apologies for posting a query as a bug.
Does this support multiple process since iOS (on iPhone) spawns multiple processes trying to access the same db?
Regards,
Nirendra
why this snippet output nothing? what is the correct way of using this method?
LevelDB *db = [LevelDB databaseInLibraryWithName:@"test.ldb"];
db.encoder = ^ NSData *(LevelDBKey *key, id object) {
return [NSKeyedArchiver archivedDataWithRootObject:object];
};
db.decoder = ^ id (LevelDBKey *key, NSData *data) {
return [NSKeyedUnarchiver unarchiveObjectWithData:data];
};
[db setObject:@"NewYork" forKey:@"foo:1"];
[db setObject:@"Paris" forKey:@"foo:2"];
[db setObject:@"Shenzhen" forKey:@"foo:3"];
[db enumerateKeysBackward:YES startingAtKey:nil filteredByPredicate:nil andPrefix:@"foo" usingBlock:^(LevelDBKey *key, BOOL *stop) {
NSLog(@"key:%@", NSStringFromLevelDBKey(key));
NSString *value = [db objectForKey:NSStringFromLevelDBKey(key)];
NSLog(@"value:%@", value);
}];
I'm trying to fork this repo for use with Facebook/RocksDB, but I'm having problems verifying that this podspec passes lint.
I clone the repo, and init/update the submodule. Then...
$ pod lib lint --verbose
(6 failures)
-> Objective-LevelDB (2.1.0)
- ERROR | [Objective-LevelDB/leveldb] [xcodebuild] /Users/i/Downloads/Objective-LevelDB/leveldb-library/util/arena.cc:5:10: fatal error: 'util/arena.h' file not found
- ERROR | [Objective-LevelDB/leveldb] [xcodebuild] /Users/i/Downloads/Objective-LevelDB/leveldb-library/table/block.cc:7:10: fatal error: 'table/block.h' file not found
- ERROR | [Objective-LevelDB/leveldb] [xcodebuild] /Users/i/Downloads/Objective-LevelDB/leveldb-library/table/block_builder.cc:29:10: fatal error: 'table/block_builder.h' file not found
- ERROR | [Objective-LevelDB/leveldb] [xcodebuild] /Users/i/Downloads/Objective-LevelDB/leveldb-library/util/bloom.cc:8:10: fatal error: 'util/hash.h' file not found
- NOTE | [Objective-LevelDB/leveldb] [xcodebuild] BuildHeaders/Objective-LevelDB/leveldb/slice.h:97:43: warning: implicit conversion loses integer precision: 'const size_t' (aka 'const unsigned long') to 'const int' [-Wshorten-64-to-32]
- NOTE | [Objective-LevelDB/leveldb] [xcodebuild] BuildHeaders/Objective-LevelDB/leveldb/slice.h:97:53: warning: implicit conversion loses integer precision: 'const size_t' (aka 'const unsigned long') to 'const int' [-Wshorten-64-to-32]
- ERROR | [Objective-LevelDB/leveldb] [xcodebuild] /Users/i/Downloads/Objective-LevelDB/leveldb-library/db/builder.cc:5:10: fatal error: 'db/builder.h' file not found
- ERROR | [Objective-LevelDB/leveldb] [xcodebuild] /Users/i/Downloads/Objective-LevelDB/leveldb-library/util/cache.cc:10:10: fatal error: 'port/port.h' file not found
I've tried to work around this by:
I feel like I'm missing something bigger... Thoughts?
pod --version, 0.33.1
It seems the class LDBWritebatch is not recognised in an Objective-C file. When i try to make the same tests you make in the doc an error appears.
Even if i add @LDBWritebatch in the imports zone i cannot access to the class methods.
will there be an option to install this via Carthage?
Cocoapods is super easy, but id much prefer to just drop a Framework into my project, and Cartage makes this super easy.
db.encoder = ^ NSData *(LevelDBKey *key, id object) {
return [NSKeyedArchiver archivedDataWithRootObject:object];
};
db.decoder = ^ id (LevelDBKey *key, NSData *data) {
return [NSKeyedUnarchiver unarchiveObjectWithData:data];
};
stop parameter passing to enumerateKeysUsingBlock block is always NO.
There are a lot of asserts in LevelDB, and XCode doesn't disable these asserts in release mode by default.
IMO, Objective-LevelDB should add NDEBUG=1
definition in podspec to disable these asserts.
When using - (void) setObject:(id)value forKey:(id)key
, encoder block would be called twice. It's inefficiency when encoding a large data.
snakeninnys-iMac:iOSTest snakeninny$ pod install
Updating local specs repositories
Analyzing dependencies
[!] Unable to find a specification for `leveldb-library (~> 1.18)` depended upon by `Objective-LevelDB`
Am I missing anything?
I think this might be because the method has the word new
as a prefix.
Is there anyway to work around this?
Getting 31 warning about Implicit conversion loses integer precision: 'unsigned long' to 'uint32_t'. Please advise.
I am using Objective-LevelDB in my Swift project, I implementation the encoder
and decoder
like this, there is nothing error with it.
self.levelDB.encoder = {(key: UnsafeMutablePointer<LevelDBKey>, object: ImplicitlyUnwrappedOptional<AnyObject>) -> NSData! in
return NSKeyedArchiver.archivedDataWithRootObject(object)
} as LevelDBEncoderBlock
self.levelDB.decoder = {(key: UnsafeMutablePointer<LevelDBKey>, data: ImplicitlyUnwrappedOptional<NSData>) -> AnyObject! in
return NSKeyedUnarchiver.unarchiveObjectWithData(data)!
} as! LevelDBDecoderBlock
But when I run this code, it crashes.
let object = NSObject()
self.levelDB.setObject(object, forKey: "key")
The error message is :
2016-01-13 19:41:15.157 LevelDBDemo[24442:9950819] -[NSObject encodeWithCoder:]: unrecognized selector sent to instance 0x7f968e0c28a0
2016-01-13 19:41:15.166 reason[24442:9950819] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSObject encodeWithCoder:]: unrecognized selector sent to instance 0x7f968e0c28a0'
How to deal with it?
I'm getting this linking issue even with a default empty project.
Deployment target 8.3
Using Objective-LevelDB (2.1.4) installed via Cocoapods
Using leveldb-library (1.18.1) installed via Cocoapods
Here's the Podfile:
platform :ios, '8.0'
use_frameworks!
target 'levelDB_test' do
pod 'Objective-LevelDB'
end
target 'levelDB_testTests' do
pod 'Objective-LevelDB'
end
Here's the error log:
duplicate symbol _main in:
/Users/luca/Library/Developer/Xcode/DerivedData/levelDB_test-gqscfpqoazdhylfthcxwbyirjqjw/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-levelDB_test-leveldb-library.build/Objects-normal/x86_64/db_bench.o
/Users/luca/Library/Developer/Xcode/DerivedData/levelDB_test-gqscfpqoazdhylfthcxwbyirjqjw/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-levelDB_test-leveldb-library.build/Objects-normal/x86_64/leveldb_main.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any suggestions will be appreciated.
Thanks.
Cheers,
Luca
I am trying to enumerate a database finding only the values that match a given predicate.
Here is my code:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY SELF.names BEGINSWITH[cd] %@", searchText];
@autoreleasepool {
[self.datastore enumerateKeysAndObjectsBackward:NO
lazily:NO
startingAtKey:nil
filteredByPredicate:predicate
andPrefix:nil
usingBlock:^(LevelDBKey *key, id value, BOOL *stop){
[self.searchResults addObject:value];
}];
}
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self.searchDisplayController.searchResultsTableView reloadData];
}];
The thing is that while enumerating Objective-LevelDB keeps all values in memory, even the ones that don't match the predicate. Not even lazy evaluation solves the issue here.
Am I doing something wrong? Can something be done to improve on memory usage?
coding.h:59:7: error: use of undeclared identifier 'port'
it seems GCC_PREPROCESSOR_DEFINITIONS
is not used
When invoking git clean
in project dir, failed with
fatal: Not a git repository: Pods/Objective-LevelDB/leveldb-library/../.git/modules/leveldb-library
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.