├── Example └── SwiftStoreExample │ ├── .gitignore │ ├── SwiftStoreExample.xcodeproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ ├── SwiftStoreExample │ ├── DB.swift │ ├── Info.plist │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Extensions.swift │ ├── AppDelegate.swift │ ├── SimpleCollectionViewController.swift │ ├── ExampleViewController.swift │ ├── Base.lproj │ │ └── LaunchScreen.xib │ └── SimpleKeyValueViewController.swift │ └── SwiftStoreExampleTests │ ├── Info.plist │ └── SwiftStoreExampleTests.swift ├── LevelDB.xcframework ├── ios-arm64 │ └── LevelDB.framework │ │ ├── Headers │ │ ├── leveldb │ │ │ ├── leveldb │ │ │ │ ├── c.h │ │ │ │ ├── db.h │ │ │ │ ├── env.h │ │ │ │ ├── cache.h │ │ │ │ ├── export.h │ │ │ │ ├── options.h │ │ │ │ ├── slice.h │ │ │ │ ├── status.h │ │ │ │ ├── table.h │ │ │ │ ├── dumpfile.h │ │ │ │ ├── iterator.h │ │ │ │ ├── comparator.h │ │ │ │ ├── write_batch.h │ │ │ │ ├── filter_policy.h │ │ │ │ └── table_builder.h │ │ │ ├── export.h │ │ │ ├── dumpfile.h │ │ │ ├── comparator.h │ │ │ ├── write_batch.h │ │ │ ├── filter_policy.h │ │ │ ├── table.h │ │ │ ├── table_builder.h │ │ │ ├── slice.h │ │ │ └── cache.h │ │ ├── export.h │ │ ├── dumpfile.h │ │ ├── comparator.h │ │ ├── write_batch.h │ │ ├── filter_policy.h │ │ ├── table.h │ │ ├── table_builder.h │ │ ├── slice.h │ │ └── cache.h │ │ ├── LevelDB │ │ └── Info.plist ├── macos-arm64_x86_64 │ └── LevelDB.framework │ │ ├── Headers │ │ ├── leveldb │ │ │ ├── leveldb │ │ │ │ ├── c.h │ │ │ │ ├── db.h │ │ │ │ ├── cache.h │ │ │ │ ├── env.h │ │ │ │ ├── slice.h │ │ │ │ ├── table.h │ │ │ │ ├── export.h │ │ │ │ ├── options.h │ │ │ │ ├── status.h │ │ │ │ ├── comparator.h │ │ │ │ ├── dumpfile.h │ │ │ │ ├── iterator.h │ │ │ │ ├── write_batch.h │ │ │ │ ├── filter_policy.h │ │ │ │ └── table_builder.h │ │ │ ├── export.h │ │ │ ├── dumpfile.h │ │ │ ├── comparator.h │ │ │ ├── write_batch.h │ │ │ ├── filter_policy.h │ │ │ ├── table.h │ │ │ ├── table_builder.h │ │ │ ├── slice.h │ │ │ └── cache.h │ │ ├── export.h │ │ ├── dumpfile.h │ │ ├── comparator.h │ │ ├── write_batch.h │ │ ├── filter_policy.h │ │ ├── table.h │ │ ├── table_builder.h │ │ ├── slice.h │ │ └── cache.h │ │ ├── LevelDB │ │ └── Info.plist ├── ios-arm64_x86_64-simulator │ └── LevelDB.framework │ │ ├── Headers │ │ ├── leveldb │ │ │ ├── leveldb │ │ │ │ ├── c.h │ │ │ │ ├── db.h │ │ │ │ ├── env.h │ │ │ │ ├── cache.h │ │ │ │ ├── export.h │ │ │ │ ├── slice.h │ │ │ │ ├── status.h │ │ │ │ ├── table.h │ │ │ │ ├── dumpfile.h │ │ │ │ ├── iterator.h │ │ │ │ ├── options.h │ │ │ │ ├── comparator.h │ │ │ │ ├── write_batch.h │ │ │ │ ├── filter_policy.h │ │ │ │ └── table_builder.h │ │ │ ├── export.h │ │ │ ├── dumpfile.h │ │ │ ├── comparator.h │ │ │ ├── write_batch.h │ │ │ ├── filter_policy.h │ │ │ ├── table.h │ │ │ ├── table_builder.h │ │ │ ├── slice.h │ │ │ └── cache.h │ │ ├── export.h │ │ ├── dumpfile.h │ │ ├── comparator.h │ │ ├── write_batch.h │ │ ├── filter_policy.h │ │ ├── table.h │ │ ├── table_builder.h │ │ ├── slice.h │ │ └── cache.h │ │ ├── LevelDB │ │ └── Info.plist └── Info.plist ├── .gitmodules ├── SwiftStoreTests ├── SwiftStoreTests-Bridging-Header.h └── Info.plist ├── SwiftStore.xcodeproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── SwiftStore ├── SwiftStore.h ├── Store.h ├── Info.plist └── SwiftStore.swift ├── .gitignore ├── LICENSE ├── scripts ├── fix_xcframework_headers.sh └── update_leveldb.sh ├── README.md └── docs └── LEVELDB_UPDATE.md /Example/SwiftStoreExample/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Carthage/* 3 | 4 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/c.h: -------------------------------------------------------------------------------- 1 | ../c.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/db.h: -------------------------------------------------------------------------------- 1 | ../db.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/env.h: -------------------------------------------------------------------------------- 1 | ../env.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/cache.h: -------------------------------------------------------------------------------- 1 | ../cache.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/export.h: -------------------------------------------------------------------------------- 1 | ../export.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/options.h: -------------------------------------------------------------------------------- 1 | ../options.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/slice.h: -------------------------------------------------------------------------------- 1 | ../slice.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/status.h: -------------------------------------------------------------------------------- 1 | ../status.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/table.h: -------------------------------------------------------------------------------- 1 | ../table.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/c.h: -------------------------------------------------------------------------------- 1 | ../c.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/db.h: -------------------------------------------------------------------------------- 1 | ../db.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/dumpfile.h: -------------------------------------------------------------------------------- 1 | ../dumpfile.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/iterator.h: -------------------------------------------------------------------------------- 1 | ../iterator.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/c.h: -------------------------------------------------------------------------------- 1 | ../c.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/cache.h: -------------------------------------------------------------------------------- 1 | ../cache.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/env.h: -------------------------------------------------------------------------------- 1 | ../env.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/slice.h: -------------------------------------------------------------------------------- 1 | ../slice.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/table.h: -------------------------------------------------------------------------------- 1 | ../table.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/comparator.h: -------------------------------------------------------------------------------- 1 | ../comparator.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/write_batch.h: -------------------------------------------------------------------------------- 1 | ../write_batch.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/db.h: -------------------------------------------------------------------------------- 1 | ../db.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/env.h: -------------------------------------------------------------------------------- 1 | ../env.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/export.h: -------------------------------------------------------------------------------- 1 | ../export.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/options.h: -------------------------------------------------------------------------------- 1 | ../options.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/status.h: -------------------------------------------------------------------------------- 1 | ../status.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/filter_policy.h: -------------------------------------------------------------------------------- 1 | ../filter_policy.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/leveldb/table_builder.h: -------------------------------------------------------------------------------- 1 | ../table_builder.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/cache.h: -------------------------------------------------------------------------------- 1 | ../cache.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/export.h: -------------------------------------------------------------------------------- 1 | ../export.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/slice.h: -------------------------------------------------------------------------------- 1 | ../slice.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/status.h: -------------------------------------------------------------------------------- 1 | ../status.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/table.h: -------------------------------------------------------------------------------- 1 | ../table.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/comparator.h: -------------------------------------------------------------------------------- 1 | ../comparator.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/dumpfile.h: -------------------------------------------------------------------------------- 1 | ../dumpfile.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/iterator.h: -------------------------------------------------------------------------------- 1 | ../iterator.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/dumpfile.h: -------------------------------------------------------------------------------- 1 | ../dumpfile.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/iterator.h: -------------------------------------------------------------------------------- 1 | ../iterator.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/options.h: -------------------------------------------------------------------------------- 1 | ../options.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/write_batch.h: -------------------------------------------------------------------------------- 1 | ../write_batch.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/comparator.h: -------------------------------------------------------------------------------- 1 | ../comparator.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/write_batch.h: -------------------------------------------------------------------------------- 1 | ../write_batch.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/filter_policy.h: -------------------------------------------------------------------------------- 1 | ../filter_policy.h -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/leveldb/table_builder.h: -------------------------------------------------------------------------------- 1 | ../table_builder.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/filter_policy.h: -------------------------------------------------------------------------------- 1 | ../filter_policy.h -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/leveldb/table_builder.h: -------------------------------------------------------------------------------- 1 | ../table_builder.h -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Example/SwiftStoreExample/Vendor/SnapKit"] 2 | path = Example/SwiftStoreExample/Vendor/SnapKit 3 | url = https://github.com/SnapKit/SnapKit 4 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/LevelDB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemantasapkota/SwiftStore/HEAD/LevelDB.xcframework/ios-arm64/LevelDB.framework/LevelDB -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/LevelDB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemantasapkota/SwiftStore/HEAD/LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/LevelDB -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/LevelDB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemantasapkota/SwiftStore/HEAD/LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/LevelDB -------------------------------------------------------------------------------- /SwiftStoreTests/SwiftStoreTests-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import 6 | 7 | -------------------------------------------------------------------------------- /SwiftStore.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftStore.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample/DB.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DB.swift 3 | // SwiftStoreExample 4 | // 5 | // Created by Hemanta Sapkota on 12/05/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SwiftStore 11 | 12 | class DB : SwiftStore { 13 | 14 | class var store:DB { 15 | struct Singleton { 16 | static let instance = DB(storeName: "db") 17 | } 18 | return Singleton.instance 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /SwiftStore/SwiftStore.h: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftStore.h 3 | // SwiftStore 4 | // 5 | // Created by Hemanta Sapkota on 4/05/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SwiftStore. 12 | FOUNDATION_EXPORT double SwiftStoreVersionNumber; 13 | 14 | //! Project version string for SwiftStore. 15 | FOUNDATION_EXPORT const unsigned char SwiftStoreVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | #import 21 | -------------------------------------------------------------------------------- /SwiftStore/Store.h: -------------------------------------------------------------------------------- 1 | // 2 | // OLDB.h 3 | // LevelDBTest 4 | // 5 | // Created by Hemanta Sapkota on 1/05/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Store : NSObject 12 | 13 | -(instancetype)initWithDBName:(NSString *) dbName; 14 | 15 | -(NSString *)get:(NSString *)key; 16 | 17 | -(bool)put:(NSString *)key value:(NSString *)value; 18 | 19 | -(bool)delete:(NSString *)key; 20 | 21 | -(bool)deleteBatch:(NSArray *)keys; 22 | 23 | -(NSArray *)iterate:(NSString *)key; 24 | 25 | -(NSArray *)findKeys:(NSString *)key; 26 | 27 | -(void)close; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | SwiftStore.framework 21 | 22 | # CocoaPods 23 | # 24 | # We recommend against adding the Pods directory to your .gitignore. However 25 | # you should judge for yourself, the pros and cons are mentioned at: 26 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 27 | # 28 | # Pods/ 29 | 30 | # Carthage 31 | # 32 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 33 | # Carthage/Checkouts 34 | 35 | Carthage/Build 36 | 37 | .DS_Store 38 | -------------------------------------------------------------------------------- /SwiftStoreTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.laex.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | LevelDB 9 | CFBundleIdentifier 10 | com.google.leveldb 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | LevelDB 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | MinimumOSVersion 22 | 11.0 23 | 24 | 25 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | LevelDB 9 | CFBundleIdentifier 10 | com.google.leveldb 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | LevelDB 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | MinimumOSVersion 22 | 10.15 23 | 24 | 25 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | LevelDB 9 | CFBundleIdentifier 10 | com.google.leveldb 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | LevelDB 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | MinimumOSVersion 22 | 11.0 23 | 24 | 25 | -------------------------------------------------------------------------------- /SwiftStore/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SwiftStore/SwiftStore.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftStore.swift 3 | // SwiftStore 4 | // 5 | // Created by Hemanta Sapkota on 4/05/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | open class SwiftStore { 12 | 13 | var db:Store! 14 | 15 | public init(storeName: String) { 16 | db = Store(dbName: storeName) 17 | } 18 | 19 | public subscript(key: String) -> String? { 20 | get { 21 | return db.get(key) 22 | } 23 | 24 | set(newValue) { 25 | db.put(key, value: newValue!) 26 | } 27 | } 28 | 29 | public func delete(key: String) -> Bool { 30 | return db.delete(key) 31 | } 32 | 33 | public func collect(key: String) -> [String] { 34 | return db.iterate(key) as! [String] 35 | } 36 | 37 | public func findKeys(key: String) -> [String] { 38 | return db.findKeys(key) as! [String] 39 | } 40 | 41 | public func deleteCollection(keys: [String]) -> Bool { 42 | return db.deleteBatch(keys) 43 | } 44 | 45 | public func close() { 46 | db.close() 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/export.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 7 | 8 | #if !defined(LEVELDB_EXPORT) 9 | 10 | #if defined(LEVELDB_SHARED_LIBRARY) 11 | #if defined(_WIN32) 12 | 13 | #if defined(LEVELDB_COMPILE_LIBRARY) 14 | #define LEVELDB_EXPORT __declspec(dllexport) 15 | #else 16 | #define LEVELDB_EXPORT __declspec(dllimport) 17 | #endif // defined(LEVELDB_COMPILE_LIBRARY) 18 | 19 | #else // defined(_WIN32) 20 | #if defined(LEVELDB_COMPILE_LIBRARY) 21 | #define LEVELDB_EXPORT __attribute__((visibility("default"))) 22 | #else 23 | #define LEVELDB_EXPORT 24 | #endif 25 | #endif // defined(_WIN32) 26 | 27 | #else // defined(LEVELDB_SHARED_LIBRARY) 28 | #define LEVELDB_EXPORT 29 | #endif 30 | 31 | #endif // !defined(LEVELDB_EXPORT) 32 | 33 | #endif // STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 34 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/export.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 7 | 8 | #if !defined(LEVELDB_EXPORT) 9 | 10 | #if defined(LEVELDB_SHARED_LIBRARY) 11 | #if defined(_WIN32) 12 | 13 | #if defined(LEVELDB_COMPILE_LIBRARY) 14 | #define LEVELDB_EXPORT __declspec(dllexport) 15 | #else 16 | #define LEVELDB_EXPORT __declspec(dllimport) 17 | #endif // defined(LEVELDB_COMPILE_LIBRARY) 18 | 19 | #else // defined(_WIN32) 20 | #if defined(LEVELDB_COMPILE_LIBRARY) 21 | #define LEVELDB_EXPORT __attribute__((visibility("default"))) 22 | #else 23 | #define LEVELDB_EXPORT 24 | #endif 25 | #endif // defined(_WIN32) 26 | 27 | #else // defined(LEVELDB_SHARED_LIBRARY) 28 | #define LEVELDB_EXPORT 29 | #endif 30 | 31 | #endif // !defined(LEVELDB_EXPORT) 32 | 33 | #endif // STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 34 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/export.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 7 | 8 | #if !defined(LEVELDB_EXPORT) 9 | 10 | #if defined(LEVELDB_SHARED_LIBRARY) 11 | #if defined(_WIN32) 12 | 13 | #if defined(LEVELDB_COMPILE_LIBRARY) 14 | #define LEVELDB_EXPORT __declspec(dllexport) 15 | #else 16 | #define LEVELDB_EXPORT __declspec(dllimport) 17 | #endif // defined(LEVELDB_COMPILE_LIBRARY) 18 | 19 | #else // defined(_WIN32) 20 | #if defined(LEVELDB_COMPILE_LIBRARY) 21 | #define LEVELDB_EXPORT __attribute__((visibility("default"))) 22 | #else 23 | #define LEVELDB_EXPORT 24 | #endif 25 | #endif // defined(_WIN32) 26 | 27 | #else // defined(LEVELDB_SHARED_LIBRARY) 28 | #define LEVELDB_EXPORT 29 | #endif 30 | 31 | #endif // !defined(LEVELDB_EXPORT) 32 | 33 | #endif // STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 34 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/dumpfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/env.h" 11 | #include "leveldb/export.h" 12 | #include "leveldb/status.h" 13 | 14 | namespace leveldb { 15 | 16 | // Dump the contents of the file named by fname in text format to 17 | // *dst. Makes a sequence of dst->Append() calls; each call is passed 18 | // the newline-terminated text corresponding to a single item found 19 | // in the file. 20 | // 21 | // Returns a non-OK result if fname does not name a leveldb storage 22 | // file, or if the file cannot be read. 23 | LEVELDB_EXPORT Status DumpFile(Env* env, const std::string& fname, 24 | WritableFile* dst); 25 | 26 | } // namespace leveldb 27 | 28 | #endif // STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 29 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/export.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 7 | 8 | #if !defined(LEVELDB_EXPORT) 9 | 10 | #if defined(LEVELDB_SHARED_LIBRARY) 11 | #if defined(_WIN32) 12 | 13 | #if defined(LEVELDB_COMPILE_LIBRARY) 14 | #define LEVELDB_EXPORT __declspec(dllexport) 15 | #else 16 | #define LEVELDB_EXPORT __declspec(dllimport) 17 | #endif // defined(LEVELDB_COMPILE_LIBRARY) 18 | 19 | #else // defined(_WIN32) 20 | #if defined(LEVELDB_COMPILE_LIBRARY) 21 | #define LEVELDB_EXPORT __attribute__((visibility("default"))) 22 | #else 23 | #define LEVELDB_EXPORT 24 | #endif 25 | #endif // defined(_WIN32) 26 | 27 | #else // defined(LEVELDB_SHARED_LIBRARY) 28 | #define LEVELDB_EXPORT 29 | #endif 30 | 31 | #endif // !defined(LEVELDB_EXPORT) 32 | 33 | #endif // STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 34 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/export.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 7 | 8 | #if !defined(LEVELDB_EXPORT) 9 | 10 | #if defined(LEVELDB_SHARED_LIBRARY) 11 | #if defined(_WIN32) 12 | 13 | #if defined(LEVELDB_COMPILE_LIBRARY) 14 | #define LEVELDB_EXPORT __declspec(dllexport) 15 | #else 16 | #define LEVELDB_EXPORT __declspec(dllimport) 17 | #endif // defined(LEVELDB_COMPILE_LIBRARY) 18 | 19 | #else // defined(_WIN32) 20 | #if defined(LEVELDB_COMPILE_LIBRARY) 21 | #define LEVELDB_EXPORT __attribute__((visibility("default"))) 22 | #else 23 | #define LEVELDB_EXPORT 24 | #endif 25 | #endif // defined(_WIN32) 26 | 27 | #else // defined(LEVELDB_SHARED_LIBRARY) 28 | #define LEVELDB_EXPORT 29 | #endif 30 | 31 | #endif // !defined(LEVELDB_EXPORT) 32 | 33 | #endif // STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 34 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/dumpfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/env.h" 11 | #include "leveldb/export.h" 12 | #include "leveldb/status.h" 13 | 14 | namespace leveldb { 15 | 16 | // Dump the contents of the file named by fname in text format to 17 | // *dst. Makes a sequence of dst->Append() calls; each call is passed 18 | // the newline-terminated text corresponding to a single item found 19 | // in the file. 20 | // 21 | // Returns a non-OK result if fname does not name a leveldb storage 22 | // file, or if the file cannot be read. 23 | LEVELDB_EXPORT Status DumpFile(Env* env, const std::string& fname, 24 | WritableFile* dst); 25 | 26 | } // namespace leveldb 27 | 28 | #endif // STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 29 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/export.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 7 | 8 | #if !defined(LEVELDB_EXPORT) 9 | 10 | #if defined(LEVELDB_SHARED_LIBRARY) 11 | #if defined(_WIN32) 12 | 13 | #if defined(LEVELDB_COMPILE_LIBRARY) 14 | #define LEVELDB_EXPORT __declspec(dllexport) 15 | #else 16 | #define LEVELDB_EXPORT __declspec(dllimport) 17 | #endif // defined(LEVELDB_COMPILE_LIBRARY) 18 | 19 | #else // defined(_WIN32) 20 | #if defined(LEVELDB_COMPILE_LIBRARY) 21 | #define LEVELDB_EXPORT __attribute__((visibility("default"))) 22 | #else 23 | #define LEVELDB_EXPORT 24 | #endif 25 | #endif // defined(_WIN32) 26 | 27 | #else // defined(LEVELDB_SHARED_LIBRARY) 28 | #define LEVELDB_EXPORT 29 | #endif 30 | 31 | #endif // !defined(LEVELDB_EXPORT) 32 | 33 | #endif // STORAGE_LEVELDB_INCLUDE_EXPORT_H_ 34 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/dumpfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/env.h" 11 | #include "leveldb/export.h" 12 | #include "leveldb/status.h" 13 | 14 | namespace leveldb { 15 | 16 | // Dump the contents of the file named by fname in text format to 17 | // *dst. Makes a sequence of dst->Append() calls; each call is passed 18 | // the newline-terminated text corresponding to a single item found 19 | // in the file. 20 | // 21 | // Returns a non-OK result if fname does not name a leveldb storage 22 | // file, or if the file cannot be read. 23 | LEVELDB_EXPORT Status DumpFile(Env* env, const std::string& fname, 24 | WritableFile* dst); 25 | 26 | } // namespace leveldb 27 | 28 | #endif // STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 29 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/dumpfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/env.h" 11 | #include "leveldb/export.h" 12 | #include "leveldb/status.h" 13 | 14 | namespace leveldb { 15 | 16 | // Dump the contents of the file named by fname in text format to 17 | // *dst. Makes a sequence of dst->Append() calls; each call is passed 18 | // the newline-terminated text corresponding to a single item found 19 | // in the file. 20 | // 21 | // Returns a non-OK result if fname does not name a leveldb storage 22 | // file, or if the file cannot be read. 23 | LEVELDB_EXPORT Status DumpFile(Env* env, const std::string& fname, 24 | WritableFile* dst); 25 | 26 | } // namespace leveldb 27 | 28 | #endif // STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 29 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/dumpfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/env.h" 11 | #include "leveldb/export.h" 12 | #include "leveldb/status.h" 13 | 14 | namespace leveldb { 15 | 16 | // Dump the contents of the file named by fname in text format to 17 | // *dst. Makes a sequence of dst->Append() calls; each call is passed 18 | // the newline-terminated text corresponding to a single item found 19 | // in the file. 20 | // 21 | // Returns a non-OK result if fname does not name a leveldb storage 22 | // file, or if the file cannot be read. 23 | LEVELDB_EXPORT Status DumpFile(Env* env, const std::string& fname, 24 | WritableFile* dst); 25 | 26 | } // namespace leveldb 27 | 28 | #endif // STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 29 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/dumpfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/env.h" 11 | #include "leveldb/export.h" 12 | #include "leveldb/status.h" 13 | 14 | namespace leveldb { 15 | 16 | // Dump the contents of the file named by fname in text format to 17 | // *dst. Makes a sequence of dst->Append() calls; each call is passed 18 | // the newline-terminated text corresponding to a single item found 19 | // in the file. 20 | // 21 | // Returns a non-OK result if fname does not name a leveldb storage 22 | // file, or if the file cannot be read. 23 | LEVELDB_EXPORT Status DumpFile(Env* env, const std::string& fname, 24 | WritableFile* dst); 25 | 26 | } // namespace leveldb 27 | 28 | #endif // STORAGE_LEVELDB_INCLUDE_DUMPFILE_H_ 29 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExampleTests/SwiftStoreExampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftStoreExampleTests.swift 3 | // SwiftStoreExampleTests 4 | // 5 | // Created by Hemanta Sapkota on 12/05/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class SwiftStoreExampleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Hemanta Sapkota 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.laex.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /scripts/fix_xcframework_headers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # This script fixes the LevelDB.xcframework header structure to make it easier to include headers 5 | 6 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 7 | XCFRAMEWORK_PATH="${SCRIPT_DIR}/../LevelDB.xcframework" 8 | 9 | if [ ! -d "$XCFRAMEWORK_PATH" ]; then 10 | echo "LevelDB.xcframework not found at $XCFRAMEWORK_PATH" 11 | exit 1 12 | fi 13 | 14 | echo "Fixing header structure in LevelDB.xcframework..." 15 | 16 | # Find all platform directories in the XCFramework 17 | PLATFORM_DIRS=$(find "$XCFRAMEWORK_PATH" -type d -name "LevelDB.framework") 18 | 19 | for PLATFORM_DIR in $PLATFORM_DIRS; do 20 | echo "Processing $PLATFORM_DIR..." 21 | HEADERS_DIR="${PLATFORM_DIR}/Headers" 22 | 23 | # Copy headers to the root for easier include 24 | if [ -d "${HEADERS_DIR}/leveldb" ]; then 25 | echo "Copying leveldb headers to root Headers directory..." 26 | cp -f "${HEADERS_DIR}/leveldb"/*.h "${HEADERS_DIR}/" 27 | 28 | # Create a symlink from leveldb/leveldb to leveldb for nested includes 29 | mkdir -p "${HEADERS_DIR}/leveldb/leveldb" 30 | for HEADER in "${HEADERS_DIR}/leveldb"/*.h; do 31 | HEADER_NAME=$(basename "$HEADER") 32 | ln -sf "../${HEADER_NAME}" "${HEADERS_DIR}/leveldb/leveldb/${HEADER_NAME}" 33 | done 34 | fi 35 | done 36 | 37 | echo "Header structure fixed successfully!" 38 | echo "" 39 | echo "Now you can include LevelDB headers in your code using:" 40 | echo " #import " 41 | echo " #import " 42 | echo " // etc." 43 | echo "" 44 | echo "Or if you prefer the existing structure:" 45 | echo " #import " 46 | echo " #import " 47 | echo " // etc." -------------------------------------------------------------------------------- /LevelDB.xcframework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AvailableLibraries 6 | 7 | 8 | BinaryPath 9 | LevelDB.framework/LevelDB 10 | LibraryIdentifier 11 | ios-arm64_x86_64-simulator 12 | LibraryPath 13 | LevelDB.framework 14 | SupportedArchitectures 15 | 16 | arm64 17 | x86_64 18 | 19 | SupportedPlatform 20 | ios 21 | SupportedPlatformVariant 22 | simulator 23 | 24 | 25 | BinaryPath 26 | LevelDB.framework/LevelDB 27 | LibraryIdentifier 28 | ios-arm64 29 | LibraryPath 30 | LevelDB.framework 31 | SupportedArchitectures 32 | 33 | arm64 34 | 35 | SupportedPlatform 36 | ios 37 | 38 | 39 | BinaryPath 40 | LevelDB.framework/LevelDB 41 | LibraryIdentifier 42 | macos-arm64_x86_64 43 | LibraryPath 44 | LevelDB.framework 45 | SupportedArchitectures 46 | 47 | arm64 48 | x86_64 49 | 50 | SupportedPlatform 51 | macos 52 | 53 | 54 | CFBundlePackageType 55 | XFWK 56 | XCFrameworkFormatVersion 57 | 1.0 58 | 59 | 60 | -------------------------------------------------------------------------------- /scripts/update_leveldb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Backup the current leveldb directory 5 | echo "Backing up old leveldb directory..." 6 | if [ -d "leveldb.bak" ]; then 7 | rm -rf leveldb.bak 8 | fi 9 | 10 | if [ -d "leveldb" ]; then 11 | mv leveldb leveldb.bak 12 | fi 13 | 14 | # Update .gitignore to include the XCFramework 15 | echo "Updating .gitignore..." 16 | if ! grep -q "LevelDB.xcframework" .gitignore; then 17 | echo "LevelDB.xcframework/" >> .gitignore 18 | fi 19 | 20 | # Fix the XCFramework headers structure 21 | echo "Fixing XCFramework headers structure..." 22 | chmod +x leveldb_build/fix_xcframework_headers.sh 23 | ./leveldb_build/fix_xcframework_headers.sh 24 | 25 | # Update the project file to use XCFramework 26 | echo "Opening Xcode project to update LevelDB references..." 27 | open SwiftStore.xcodeproj 28 | 29 | echo "Done!" 30 | echo "Please manually update the project to use LevelDB.xcframework instead of the old leveldb directory." 31 | echo "Instructions:" 32 | echo "1. Remove the existing leveldb reference from the project navigator" 33 | echo "2. Drag LevelDB.xcframework into the project navigator (select 'Copy items if needed')" 34 | echo "3. Go to the SwiftStore target > General > Frameworks, Libraries, and Embedded Content" 35 | echo "4. Add LevelDB.xcframework" 36 | echo "5. Go to Build Settings > Search Paths > Header Search Paths" 37 | echo "6. Replace '\$(SRCROOT)/leveldb/include/' with '\$(SRCROOT)/LevelDB.xcframework/Headers'" 38 | echo "7. Go to Other Linker Flags and remove '-lleveldb'" 39 | echo "8. Save and close Xcode" 40 | echo "" 41 | echo "Note: LevelDB headers can now be included using the simplified format:" 42 | echo " #import " 43 | echo " #import " 44 | echo "or the original format:" 45 | echo " #import " 46 | echo " #import " -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample/Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extensions.swift 3 | // SwiftStoreExample 4 | // 5 | // Created by Hemanta Sapkota on 31/05/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | //From https://github.com/yeahdongcn/UIColor-Hex-Swift 13 | extension UIColor { 14 | convenience init(rgba: String) { 15 | var red: CGFloat = 0.0 16 | var green: CGFloat = 0.0 17 | var blue: CGFloat = 0.0 18 | var alpha: CGFloat = 1.0 19 | 20 | if rgba.hasPrefix("#") { 21 | let index = rgba.index(rgba.startIndex, offsetBy: 1) 22 | let hex = rgba.substring(from: index) 23 | let scanner = Scanner(string: hex) 24 | var hexValue: CUnsignedLongLong = 0 25 | if scanner.scanHexInt64(&hexValue) { 26 | switch (hex.count) { 27 | case 3: 28 | red = CGFloat((hexValue & 0xF00) >> 8) / 15.0 29 | green = CGFloat((hexValue & 0x0F0) >> 4) / 15.0 30 | blue = CGFloat(hexValue & 0x00F) / 15.0 31 | case 4: 32 | red = CGFloat((hexValue & 0xF000) >> 12) / 15.0 33 | green = CGFloat((hexValue & 0x0F00) >> 8) / 15.0 34 | blue = CGFloat((hexValue & 0x00F0) >> 4) / 15.0 35 | alpha = CGFloat(hexValue & 0x000F) / 15.0 36 | case 6: 37 | red = CGFloat((hexValue & 0xFF0000) >> 16) / 255.0 38 | green = CGFloat((hexValue & 0x00FF00) >> 8) / 255.0 39 | blue = CGFloat(hexValue & 0x0000FF) / 255.0 40 | case 8: 41 | red = CGFloat((hexValue & 0xFF000000) >> 24) / 255.0 42 | green = CGFloat((hexValue & 0x00FF0000) >> 16) / 255.0 43 | blue = CGFloat((hexValue & 0x0000FF00) >> 8) / 255.0 44 | alpha = CGFloat(hexValue & 0x000000FF) / 255.0 45 | default: 46 | print("Invalid RGB string, number of characters after '#' should be either 3, 4, 6 or 8", terminator: "") 47 | } 48 | } else { 49 | print("Scan hex error") 50 | } 51 | } else { 52 | print("Invalid RGB string, missing '#' as prefix", terminator: "") 53 | } 54 | self.init(red:red, green:green, blue:blue, alpha:alpha) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftStoreExample 4 | // 5 | // Created by Hemanta Sapkota on 12/05/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftStore 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | 19 | window = UIWindow(frame: UIScreen.main.bounds) 20 | window?.backgroundColor = UIColor.white 21 | 22 | let navController = UINavigationController(rootViewController: ExampleViewController()) 23 | 24 | window?.rootViewController = navController 25 | 26 | window?.makeKeyAndVisible() 27 | 28 | return true 29 | } 30 | 31 | func applicationWillResignActive(_ application: UIApplication) { 32 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 33 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 34 | } 35 | 36 | func applicationDidEnterBackground(_ application: UIApplication) { 37 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 38 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 39 | } 40 | 41 | func applicationWillEnterForeground(_ application: UIApplication) { 42 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | func applicationDidBecomeActive(_ application: UIApplication) { 46 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 47 | } 48 | 49 | func applicationWillTerminate(_ application: UIApplication) { 50 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 51 | } 52 | 53 | 54 | } 55 | 56 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample/SimpleCollectionViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleCollectionViewController.swift 3 | // SwiftStoreExample 4 | // 5 | // Created by Hemanta Sapkota on 3/06/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class SimpleCollectionViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { 13 | 14 | var sectionTitles = ["Common Names", "Popular Places"] 15 | private var tableView = UITableView() 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | tableView.dataSource = self 21 | tableView.delegate = self 22 | tableView.register(TableViewCell.self, forCellReuseIdentifier: "Cell") 23 | 24 | view.addSubview(tableView) 25 | 26 | setupConstraints() 27 | } 28 | 29 | private func setupConstraints() { 30 | tableView.translatesAutoresizingMaskIntoConstraints = false 31 | NSLayoutConstraint.activate([ 32 | tableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), 33 | tableView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), 34 | tableView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), 35 | tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor) 36 | ]) 37 | } 38 | } 39 | 40 | extension SimpleCollectionViewController { 41 | 42 | @objc(numberOfSectionsInTableView:) func numberOfSections(in tableView: UITableView) -> Int { 43 | return 3 44 | } 45 | 46 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 47 | return 10 48 | } 49 | 50 | @objc(tableView:cellForRowAtIndexPath:) func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 51 | let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! TableViewCell 52 | cell.textLabel!.text = "Hello" 53 | return cell 54 | } 55 | 56 | } 57 | 58 | extension SimpleCollectionViewController { 59 | 60 | class TableViewCell : UITableViewCell { 61 | 62 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 63 | super.init(style: style, reuseIdentifier: reuseIdentifier) 64 | } 65 | 66 | required init?(coder aDecoder: NSCoder) { 67 | fatalError("init(coder:) has not been implemented") 68 | } 69 | 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/comparator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | 12 | namespace leveldb { 13 | 14 | class Slice; 15 | 16 | // A Comparator object provides a total order across slices that are 17 | // used as keys in an sstable or a database. A Comparator implementation 18 | // must be thread-safe since leveldb may invoke its methods concurrently 19 | // from multiple threads. 20 | class LEVELDB_EXPORT Comparator { 21 | public: 22 | virtual ~Comparator(); 23 | 24 | // Three-way comparison. Returns value: 25 | // < 0 iff "a" < "b", 26 | // == 0 iff "a" == "b", 27 | // > 0 iff "a" > "b" 28 | virtual int Compare(const Slice& a, const Slice& b) const = 0; 29 | 30 | // The name of the comparator. Used to check for comparator 31 | // mismatches (i.e., a DB created with one comparator is 32 | // accessed using a different comparator. 33 | // 34 | // The client of this package should switch to a new name whenever 35 | // the comparator implementation changes in a way that will cause 36 | // the relative ordering of any two keys to change. 37 | // 38 | // Names starting with "leveldb." are reserved and should not be used 39 | // by any clients of this package. 40 | virtual const char* Name() const = 0; 41 | 42 | // Advanced functions: these are used to reduce the space requirements 43 | // for internal data structures like index blocks. 44 | 45 | // If *start < limit, changes *start to a short string in [start,limit). 46 | // Simple comparator implementations may return with *start unchanged, 47 | // i.e., an implementation of this method that does nothing is correct. 48 | virtual void FindShortestSeparator(std::string* start, 49 | const Slice& limit) const = 0; 50 | 51 | // Changes *key to a short string >= *key. 52 | // Simple comparator implementations may return with *key unchanged, 53 | // i.e., an implementation of this method that does nothing is correct. 54 | virtual void FindShortSuccessor(std::string* key) const = 0; 55 | }; 56 | 57 | // Return a builtin comparator that uses lexicographic byte-wise 58 | // ordering. The result remains the property of this module and 59 | // must not be deleted. 60 | LEVELDB_EXPORT const Comparator* BytewiseComparator(); 61 | 62 | } // namespace leveldb 63 | 64 | #endif // STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 65 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/comparator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | 12 | namespace leveldb { 13 | 14 | class Slice; 15 | 16 | // A Comparator object provides a total order across slices that are 17 | // used as keys in an sstable or a database. A Comparator implementation 18 | // must be thread-safe since leveldb may invoke its methods concurrently 19 | // from multiple threads. 20 | class LEVELDB_EXPORT Comparator { 21 | public: 22 | virtual ~Comparator(); 23 | 24 | // Three-way comparison. Returns value: 25 | // < 0 iff "a" < "b", 26 | // == 0 iff "a" == "b", 27 | // > 0 iff "a" > "b" 28 | virtual int Compare(const Slice& a, const Slice& b) const = 0; 29 | 30 | // The name of the comparator. Used to check for comparator 31 | // mismatches (i.e., a DB created with one comparator is 32 | // accessed using a different comparator. 33 | // 34 | // The client of this package should switch to a new name whenever 35 | // the comparator implementation changes in a way that will cause 36 | // the relative ordering of any two keys to change. 37 | // 38 | // Names starting with "leveldb." are reserved and should not be used 39 | // by any clients of this package. 40 | virtual const char* Name() const = 0; 41 | 42 | // Advanced functions: these are used to reduce the space requirements 43 | // for internal data structures like index blocks. 44 | 45 | // If *start < limit, changes *start to a short string in [start,limit). 46 | // Simple comparator implementations may return with *start unchanged, 47 | // i.e., an implementation of this method that does nothing is correct. 48 | virtual void FindShortestSeparator(std::string* start, 49 | const Slice& limit) const = 0; 50 | 51 | // Changes *key to a short string >= *key. 52 | // Simple comparator implementations may return with *key unchanged, 53 | // i.e., an implementation of this method that does nothing is correct. 54 | virtual void FindShortSuccessor(std::string* key) const = 0; 55 | }; 56 | 57 | // Return a builtin comparator that uses lexicographic byte-wise 58 | // ordering. The result remains the property of this module and 59 | // must not be deleted. 60 | LEVELDB_EXPORT const Comparator* BytewiseComparator(); 61 | 62 | } // namespace leveldb 63 | 64 | #endif // STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 65 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/comparator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | 12 | namespace leveldb { 13 | 14 | class Slice; 15 | 16 | // A Comparator object provides a total order across slices that are 17 | // used as keys in an sstable or a database. A Comparator implementation 18 | // must be thread-safe since leveldb may invoke its methods concurrently 19 | // from multiple threads. 20 | class LEVELDB_EXPORT Comparator { 21 | public: 22 | virtual ~Comparator(); 23 | 24 | // Three-way comparison. Returns value: 25 | // < 0 iff "a" < "b", 26 | // == 0 iff "a" == "b", 27 | // > 0 iff "a" > "b" 28 | virtual int Compare(const Slice& a, const Slice& b) const = 0; 29 | 30 | // The name of the comparator. Used to check for comparator 31 | // mismatches (i.e., a DB created with one comparator is 32 | // accessed using a different comparator. 33 | // 34 | // The client of this package should switch to a new name whenever 35 | // the comparator implementation changes in a way that will cause 36 | // the relative ordering of any two keys to change. 37 | // 38 | // Names starting with "leveldb." are reserved and should not be used 39 | // by any clients of this package. 40 | virtual const char* Name() const = 0; 41 | 42 | // Advanced functions: these are used to reduce the space requirements 43 | // for internal data structures like index blocks. 44 | 45 | // If *start < limit, changes *start to a short string in [start,limit). 46 | // Simple comparator implementations may return with *start unchanged, 47 | // i.e., an implementation of this method that does nothing is correct. 48 | virtual void FindShortestSeparator(std::string* start, 49 | const Slice& limit) const = 0; 50 | 51 | // Changes *key to a short string >= *key. 52 | // Simple comparator implementations may return with *key unchanged, 53 | // i.e., an implementation of this method that does nothing is correct. 54 | virtual void FindShortSuccessor(std::string* key) const = 0; 55 | }; 56 | 57 | // Return a builtin comparator that uses lexicographic byte-wise 58 | // ordering. The result remains the property of this module and 59 | // must not be deleted. 60 | LEVELDB_EXPORT const Comparator* BytewiseComparator(); 61 | 62 | } // namespace leveldb 63 | 64 | #endif // STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 65 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/comparator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | 12 | namespace leveldb { 13 | 14 | class Slice; 15 | 16 | // A Comparator object provides a total order across slices that are 17 | // used as keys in an sstable or a database. A Comparator implementation 18 | // must be thread-safe since leveldb may invoke its methods concurrently 19 | // from multiple threads. 20 | class LEVELDB_EXPORT Comparator { 21 | public: 22 | virtual ~Comparator(); 23 | 24 | // Three-way comparison. Returns value: 25 | // < 0 iff "a" < "b", 26 | // == 0 iff "a" == "b", 27 | // > 0 iff "a" > "b" 28 | virtual int Compare(const Slice& a, const Slice& b) const = 0; 29 | 30 | // The name of the comparator. Used to check for comparator 31 | // mismatches (i.e., a DB created with one comparator is 32 | // accessed using a different comparator. 33 | // 34 | // The client of this package should switch to a new name whenever 35 | // the comparator implementation changes in a way that will cause 36 | // the relative ordering of any two keys to change. 37 | // 38 | // Names starting with "leveldb." are reserved and should not be used 39 | // by any clients of this package. 40 | virtual const char* Name() const = 0; 41 | 42 | // Advanced functions: these are used to reduce the space requirements 43 | // for internal data structures like index blocks. 44 | 45 | // If *start < limit, changes *start to a short string in [start,limit). 46 | // Simple comparator implementations may return with *start unchanged, 47 | // i.e., an implementation of this method that does nothing is correct. 48 | virtual void FindShortestSeparator(std::string* start, 49 | const Slice& limit) const = 0; 50 | 51 | // Changes *key to a short string >= *key. 52 | // Simple comparator implementations may return with *key unchanged, 53 | // i.e., an implementation of this method that does nothing is correct. 54 | virtual void FindShortSuccessor(std::string* key) const = 0; 55 | }; 56 | 57 | // Return a builtin comparator that uses lexicographic byte-wise 58 | // ordering. The result remains the property of this module and 59 | // must not be deleted. 60 | LEVELDB_EXPORT const Comparator* BytewiseComparator(); 61 | 62 | } // namespace leveldb 63 | 64 | #endif // STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 65 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/comparator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | 12 | namespace leveldb { 13 | 14 | class Slice; 15 | 16 | // A Comparator object provides a total order across slices that are 17 | // used as keys in an sstable or a database. A Comparator implementation 18 | // must be thread-safe since leveldb may invoke its methods concurrently 19 | // from multiple threads. 20 | class LEVELDB_EXPORT Comparator { 21 | public: 22 | virtual ~Comparator(); 23 | 24 | // Three-way comparison. Returns value: 25 | // < 0 iff "a" < "b", 26 | // == 0 iff "a" == "b", 27 | // > 0 iff "a" > "b" 28 | virtual int Compare(const Slice& a, const Slice& b) const = 0; 29 | 30 | // The name of the comparator. Used to check for comparator 31 | // mismatches (i.e., a DB created with one comparator is 32 | // accessed using a different comparator. 33 | // 34 | // The client of this package should switch to a new name whenever 35 | // the comparator implementation changes in a way that will cause 36 | // the relative ordering of any two keys to change. 37 | // 38 | // Names starting with "leveldb." are reserved and should not be used 39 | // by any clients of this package. 40 | virtual const char* Name() const = 0; 41 | 42 | // Advanced functions: these are used to reduce the space requirements 43 | // for internal data structures like index blocks. 44 | 45 | // If *start < limit, changes *start to a short string in [start,limit). 46 | // Simple comparator implementations may return with *start unchanged, 47 | // i.e., an implementation of this method that does nothing is correct. 48 | virtual void FindShortestSeparator(std::string* start, 49 | const Slice& limit) const = 0; 50 | 51 | // Changes *key to a short string >= *key. 52 | // Simple comparator implementations may return with *key unchanged, 53 | // i.e., an implementation of this method that does nothing is correct. 54 | virtual void FindShortSuccessor(std::string* key) const = 0; 55 | }; 56 | 57 | // Return a builtin comparator that uses lexicographic byte-wise 58 | // ordering. The result remains the property of this module and 59 | // must not be deleted. 60 | LEVELDB_EXPORT const Comparator* BytewiseComparator(); 61 | 62 | } // namespace leveldb 63 | 64 | #endif // STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 65 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/comparator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | 12 | namespace leveldb { 13 | 14 | class Slice; 15 | 16 | // A Comparator object provides a total order across slices that are 17 | // used as keys in an sstable or a database. A Comparator implementation 18 | // must be thread-safe since leveldb may invoke its methods concurrently 19 | // from multiple threads. 20 | class LEVELDB_EXPORT Comparator { 21 | public: 22 | virtual ~Comparator(); 23 | 24 | // Three-way comparison. Returns value: 25 | // < 0 iff "a" < "b", 26 | // == 0 iff "a" == "b", 27 | // > 0 iff "a" > "b" 28 | virtual int Compare(const Slice& a, const Slice& b) const = 0; 29 | 30 | // The name of the comparator. Used to check for comparator 31 | // mismatches (i.e., a DB created with one comparator is 32 | // accessed using a different comparator. 33 | // 34 | // The client of this package should switch to a new name whenever 35 | // the comparator implementation changes in a way that will cause 36 | // the relative ordering of any two keys to change. 37 | // 38 | // Names starting with "leveldb." are reserved and should not be used 39 | // by any clients of this package. 40 | virtual const char* Name() const = 0; 41 | 42 | // Advanced functions: these are used to reduce the space requirements 43 | // for internal data structures like index blocks. 44 | 45 | // If *start < limit, changes *start to a short string in [start,limit). 46 | // Simple comparator implementations may return with *start unchanged, 47 | // i.e., an implementation of this method that does nothing is correct. 48 | virtual void FindShortestSeparator(std::string* start, 49 | const Slice& limit) const = 0; 50 | 51 | // Changes *key to a short string >= *key. 52 | // Simple comparator implementations may return with *key unchanged, 53 | // i.e., an implementation of this method that does nothing is correct. 54 | virtual void FindShortSuccessor(std::string* key) const = 0; 55 | }; 56 | 57 | // Return a builtin comparator that uses lexicographic byte-wise 58 | // ordering. The result remains the property of this module and 59 | // must not be deleted. 60 | LEVELDB_EXPORT const Comparator* BytewiseComparator(); 61 | 62 | } // namespace leveldb 63 | 64 | #endif // STORAGE_LEVELDB_INCLUDE_COMPARATOR_H_ 65 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/write_batch.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // WriteBatch holds a collection of updates to apply atomically to a DB. 6 | // 7 | // The updates are applied in the order in which they are added 8 | // to the WriteBatch. For example, the value of "key" will be "v3" 9 | // after the following batch is written: 10 | // 11 | // batch.Put("key", "v1"); 12 | // batch.Delete("key"); 13 | // batch.Put("key", "v2"); 14 | // batch.Put("key", "v3"); 15 | // 16 | // Multiple threads can invoke const methods on a WriteBatch without 17 | // external synchronization, but if any of the threads may call a 18 | // non-const method, all threads accessing the same WriteBatch must use 19 | // external synchronization. 20 | 21 | #ifndef STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 22 | #define STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 23 | 24 | #include 25 | 26 | #include "leveldb/export.h" 27 | #include "leveldb/status.h" 28 | 29 | namespace leveldb { 30 | 31 | class Slice; 32 | 33 | class LEVELDB_EXPORT WriteBatch { 34 | public: 35 | class LEVELDB_EXPORT Handler { 36 | public: 37 | virtual ~Handler(); 38 | virtual void Put(const Slice& key, const Slice& value) = 0; 39 | virtual void Delete(const Slice& key) = 0; 40 | }; 41 | 42 | WriteBatch(); 43 | 44 | // Intentionally copyable. 45 | WriteBatch(const WriteBatch&) = default; 46 | WriteBatch& operator=(const WriteBatch&) = default; 47 | 48 | ~WriteBatch(); 49 | 50 | // Store the mapping "key->value" in the database. 51 | void Put(const Slice& key, const Slice& value); 52 | 53 | // If the database contains a mapping for "key", erase it. Else do nothing. 54 | void Delete(const Slice& key); 55 | 56 | // Clear all updates buffered in this batch. 57 | void Clear(); 58 | 59 | // The size of the database changes caused by this batch. 60 | // 61 | // This number is tied to implementation details, and may change across 62 | // releases. It is intended for LevelDB usage metrics. 63 | size_t ApproximateSize() const; 64 | 65 | // Copies the operations in "source" to this batch. 66 | // 67 | // This runs in O(source size) time. However, the constant factor is better 68 | // than calling Iterate() over the source batch with a Handler that replicates 69 | // the operations into this batch. 70 | void Append(const WriteBatch& source); 71 | 72 | // Support for iterating over the contents of a batch. 73 | Status Iterate(Handler* handler) const; 74 | 75 | private: 76 | friend class WriteBatchInternal; 77 | 78 | std::string rep_; // See comment in write_batch.cc for the format of rep_ 79 | }; 80 | 81 | } // namespace leveldb 82 | 83 | #endif // STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 84 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/write_batch.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // WriteBatch holds a collection of updates to apply atomically to a DB. 6 | // 7 | // The updates are applied in the order in which they are added 8 | // to the WriteBatch. For example, the value of "key" will be "v3" 9 | // after the following batch is written: 10 | // 11 | // batch.Put("key", "v1"); 12 | // batch.Delete("key"); 13 | // batch.Put("key", "v2"); 14 | // batch.Put("key", "v3"); 15 | // 16 | // Multiple threads can invoke const methods on a WriteBatch without 17 | // external synchronization, but if any of the threads may call a 18 | // non-const method, all threads accessing the same WriteBatch must use 19 | // external synchronization. 20 | 21 | #ifndef STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 22 | #define STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 23 | 24 | #include 25 | 26 | #include "leveldb/export.h" 27 | #include "leveldb/status.h" 28 | 29 | namespace leveldb { 30 | 31 | class Slice; 32 | 33 | class LEVELDB_EXPORT WriteBatch { 34 | public: 35 | class LEVELDB_EXPORT Handler { 36 | public: 37 | virtual ~Handler(); 38 | virtual void Put(const Slice& key, const Slice& value) = 0; 39 | virtual void Delete(const Slice& key) = 0; 40 | }; 41 | 42 | WriteBatch(); 43 | 44 | // Intentionally copyable. 45 | WriteBatch(const WriteBatch&) = default; 46 | WriteBatch& operator=(const WriteBatch&) = default; 47 | 48 | ~WriteBatch(); 49 | 50 | // Store the mapping "key->value" in the database. 51 | void Put(const Slice& key, const Slice& value); 52 | 53 | // If the database contains a mapping for "key", erase it. Else do nothing. 54 | void Delete(const Slice& key); 55 | 56 | // Clear all updates buffered in this batch. 57 | void Clear(); 58 | 59 | // The size of the database changes caused by this batch. 60 | // 61 | // This number is tied to implementation details, and may change across 62 | // releases. It is intended for LevelDB usage metrics. 63 | size_t ApproximateSize() const; 64 | 65 | // Copies the operations in "source" to this batch. 66 | // 67 | // This runs in O(source size) time. However, the constant factor is better 68 | // than calling Iterate() over the source batch with a Handler that replicates 69 | // the operations into this batch. 70 | void Append(const WriteBatch& source); 71 | 72 | // Support for iterating over the contents of a batch. 73 | Status Iterate(Handler* handler) const; 74 | 75 | private: 76 | friend class WriteBatchInternal; 77 | 78 | std::string rep_; // See comment in write_batch.cc for the format of rep_ 79 | }; 80 | 81 | } // namespace leveldb 82 | 83 | #endif // STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 84 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/write_batch.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // WriteBatch holds a collection of updates to apply atomically to a DB. 6 | // 7 | // The updates are applied in the order in which they are added 8 | // to the WriteBatch. For example, the value of "key" will be "v3" 9 | // after the following batch is written: 10 | // 11 | // batch.Put("key", "v1"); 12 | // batch.Delete("key"); 13 | // batch.Put("key", "v2"); 14 | // batch.Put("key", "v3"); 15 | // 16 | // Multiple threads can invoke const methods on a WriteBatch without 17 | // external synchronization, but if any of the threads may call a 18 | // non-const method, all threads accessing the same WriteBatch must use 19 | // external synchronization. 20 | 21 | #ifndef STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 22 | #define STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 23 | 24 | #include 25 | 26 | #include "leveldb/export.h" 27 | #include "leveldb/status.h" 28 | 29 | namespace leveldb { 30 | 31 | class Slice; 32 | 33 | class LEVELDB_EXPORT WriteBatch { 34 | public: 35 | class LEVELDB_EXPORT Handler { 36 | public: 37 | virtual ~Handler(); 38 | virtual void Put(const Slice& key, const Slice& value) = 0; 39 | virtual void Delete(const Slice& key) = 0; 40 | }; 41 | 42 | WriteBatch(); 43 | 44 | // Intentionally copyable. 45 | WriteBatch(const WriteBatch&) = default; 46 | WriteBatch& operator=(const WriteBatch&) = default; 47 | 48 | ~WriteBatch(); 49 | 50 | // Store the mapping "key->value" in the database. 51 | void Put(const Slice& key, const Slice& value); 52 | 53 | // If the database contains a mapping for "key", erase it. Else do nothing. 54 | void Delete(const Slice& key); 55 | 56 | // Clear all updates buffered in this batch. 57 | void Clear(); 58 | 59 | // The size of the database changes caused by this batch. 60 | // 61 | // This number is tied to implementation details, and may change across 62 | // releases. It is intended for LevelDB usage metrics. 63 | size_t ApproximateSize() const; 64 | 65 | // Copies the operations in "source" to this batch. 66 | // 67 | // This runs in O(source size) time. However, the constant factor is better 68 | // than calling Iterate() over the source batch with a Handler that replicates 69 | // the operations into this batch. 70 | void Append(const WriteBatch& source); 71 | 72 | // Support for iterating over the contents of a batch. 73 | Status Iterate(Handler* handler) const; 74 | 75 | private: 76 | friend class WriteBatchInternal; 77 | 78 | std::string rep_; // See comment in write_batch.cc for the format of rep_ 79 | }; 80 | 81 | } // namespace leveldb 82 | 83 | #endif // STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 84 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/write_batch.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // WriteBatch holds a collection of updates to apply atomically to a DB. 6 | // 7 | // The updates are applied in the order in which they are added 8 | // to the WriteBatch. For example, the value of "key" will be "v3" 9 | // after the following batch is written: 10 | // 11 | // batch.Put("key", "v1"); 12 | // batch.Delete("key"); 13 | // batch.Put("key", "v2"); 14 | // batch.Put("key", "v3"); 15 | // 16 | // Multiple threads can invoke const methods on a WriteBatch without 17 | // external synchronization, but if any of the threads may call a 18 | // non-const method, all threads accessing the same WriteBatch must use 19 | // external synchronization. 20 | 21 | #ifndef STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 22 | #define STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 23 | 24 | #include 25 | 26 | #include "leveldb/export.h" 27 | #include "leveldb/status.h" 28 | 29 | namespace leveldb { 30 | 31 | class Slice; 32 | 33 | class LEVELDB_EXPORT WriteBatch { 34 | public: 35 | class LEVELDB_EXPORT Handler { 36 | public: 37 | virtual ~Handler(); 38 | virtual void Put(const Slice& key, const Slice& value) = 0; 39 | virtual void Delete(const Slice& key) = 0; 40 | }; 41 | 42 | WriteBatch(); 43 | 44 | // Intentionally copyable. 45 | WriteBatch(const WriteBatch&) = default; 46 | WriteBatch& operator=(const WriteBatch&) = default; 47 | 48 | ~WriteBatch(); 49 | 50 | // Store the mapping "key->value" in the database. 51 | void Put(const Slice& key, const Slice& value); 52 | 53 | // If the database contains a mapping for "key", erase it. Else do nothing. 54 | void Delete(const Slice& key); 55 | 56 | // Clear all updates buffered in this batch. 57 | void Clear(); 58 | 59 | // The size of the database changes caused by this batch. 60 | // 61 | // This number is tied to implementation details, and may change across 62 | // releases. It is intended for LevelDB usage metrics. 63 | size_t ApproximateSize() const; 64 | 65 | // Copies the operations in "source" to this batch. 66 | // 67 | // This runs in O(source size) time. However, the constant factor is better 68 | // than calling Iterate() over the source batch with a Handler that replicates 69 | // the operations into this batch. 70 | void Append(const WriteBatch& source); 71 | 72 | // Support for iterating over the contents of a batch. 73 | Status Iterate(Handler* handler) const; 74 | 75 | private: 76 | friend class WriteBatchInternal; 77 | 78 | std::string rep_; // See comment in write_batch.cc for the format of rep_ 79 | }; 80 | 81 | } // namespace leveldb 82 | 83 | #endif // STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 84 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/write_batch.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // WriteBatch holds a collection of updates to apply atomically to a DB. 6 | // 7 | // The updates are applied in the order in which they are added 8 | // to the WriteBatch. For example, the value of "key" will be "v3" 9 | // after the following batch is written: 10 | // 11 | // batch.Put("key", "v1"); 12 | // batch.Delete("key"); 13 | // batch.Put("key", "v2"); 14 | // batch.Put("key", "v3"); 15 | // 16 | // Multiple threads can invoke const methods on a WriteBatch without 17 | // external synchronization, but if any of the threads may call a 18 | // non-const method, all threads accessing the same WriteBatch must use 19 | // external synchronization. 20 | 21 | #ifndef STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 22 | #define STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 23 | 24 | #include 25 | 26 | #include "leveldb/export.h" 27 | #include "leveldb/status.h" 28 | 29 | namespace leveldb { 30 | 31 | class Slice; 32 | 33 | class LEVELDB_EXPORT WriteBatch { 34 | public: 35 | class LEVELDB_EXPORT Handler { 36 | public: 37 | virtual ~Handler(); 38 | virtual void Put(const Slice& key, const Slice& value) = 0; 39 | virtual void Delete(const Slice& key) = 0; 40 | }; 41 | 42 | WriteBatch(); 43 | 44 | // Intentionally copyable. 45 | WriteBatch(const WriteBatch&) = default; 46 | WriteBatch& operator=(const WriteBatch&) = default; 47 | 48 | ~WriteBatch(); 49 | 50 | // Store the mapping "key->value" in the database. 51 | void Put(const Slice& key, const Slice& value); 52 | 53 | // If the database contains a mapping for "key", erase it. Else do nothing. 54 | void Delete(const Slice& key); 55 | 56 | // Clear all updates buffered in this batch. 57 | void Clear(); 58 | 59 | // The size of the database changes caused by this batch. 60 | // 61 | // This number is tied to implementation details, and may change across 62 | // releases. It is intended for LevelDB usage metrics. 63 | size_t ApproximateSize() const; 64 | 65 | // Copies the operations in "source" to this batch. 66 | // 67 | // This runs in O(source size) time. However, the constant factor is better 68 | // than calling Iterate() over the source batch with a Handler that replicates 69 | // the operations into this batch. 70 | void Append(const WriteBatch& source); 71 | 72 | // Support for iterating over the contents of a batch. 73 | Status Iterate(Handler* handler) const; 74 | 75 | private: 76 | friend class WriteBatchInternal; 77 | 78 | std::string rep_; // See comment in write_batch.cc for the format of rep_ 79 | }; 80 | 81 | } // namespace leveldb 82 | 83 | #endif // STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 84 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/write_batch.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // WriteBatch holds a collection of updates to apply atomically to a DB. 6 | // 7 | // The updates are applied in the order in which they are added 8 | // to the WriteBatch. For example, the value of "key" will be "v3" 9 | // after the following batch is written: 10 | // 11 | // batch.Put("key", "v1"); 12 | // batch.Delete("key"); 13 | // batch.Put("key", "v2"); 14 | // batch.Put("key", "v3"); 15 | // 16 | // Multiple threads can invoke const methods on a WriteBatch without 17 | // external synchronization, but if any of the threads may call a 18 | // non-const method, all threads accessing the same WriteBatch must use 19 | // external synchronization. 20 | 21 | #ifndef STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 22 | #define STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 23 | 24 | #include 25 | 26 | #include "leveldb/export.h" 27 | #include "leveldb/status.h" 28 | 29 | namespace leveldb { 30 | 31 | class Slice; 32 | 33 | class LEVELDB_EXPORT WriteBatch { 34 | public: 35 | class LEVELDB_EXPORT Handler { 36 | public: 37 | virtual ~Handler(); 38 | virtual void Put(const Slice& key, const Slice& value) = 0; 39 | virtual void Delete(const Slice& key) = 0; 40 | }; 41 | 42 | WriteBatch(); 43 | 44 | // Intentionally copyable. 45 | WriteBatch(const WriteBatch&) = default; 46 | WriteBatch& operator=(const WriteBatch&) = default; 47 | 48 | ~WriteBatch(); 49 | 50 | // Store the mapping "key->value" in the database. 51 | void Put(const Slice& key, const Slice& value); 52 | 53 | // If the database contains a mapping for "key", erase it. Else do nothing. 54 | void Delete(const Slice& key); 55 | 56 | // Clear all updates buffered in this batch. 57 | void Clear(); 58 | 59 | // The size of the database changes caused by this batch. 60 | // 61 | // This number is tied to implementation details, and may change across 62 | // releases. It is intended for LevelDB usage metrics. 63 | size_t ApproximateSize() const; 64 | 65 | // Copies the operations in "source" to this batch. 66 | // 67 | // This runs in O(source size) time. However, the constant factor is better 68 | // than calling Iterate() over the source batch with a Handler that replicates 69 | // the operations into this batch. 70 | void Append(const WriteBatch& source); 71 | 72 | // Support for iterating over the contents of a batch. 73 | Status Iterate(Handler* handler) const; 74 | 75 | private: 76 | friend class WriteBatchInternal; 77 | 78 | std::string rep_; // See comment in write_batch.cc for the format of rep_ 79 | }; 80 | 81 | } // namespace leveldb 82 | 83 | #endif // STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ 84 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample/ExampleViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleViewController.swift 3 | // SwiftStoreExample 4 | // 5 | // Created by Hemanta Sapkota on 31/05/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import SnapKit 12 | 13 | class ExampleViewController : UIViewController { 14 | 15 | override func viewDidLoad() { 16 | title = "Swift Store Demo" 17 | 18 | let exampleView = ExampleView() 19 | 20 | exampleView.viewPusher = { viewController in 21 | self.navigationController?.pushViewController(viewController, animated: true) 22 | } 23 | 24 | view = exampleView 25 | } 26 | } 27 | 28 | class ExampleView : UIView, UITableViewDataSource, UITableViewDelegate { 29 | 30 | /* Items */ 31 | var items = ["Saving Key / Value Pairs" ] 32 | 33 | /* Table View */ 34 | var tableView: UITableView! 35 | 36 | var viewPusher: ( (UIViewController) -> Void)! 37 | 38 | init() { 39 | super.init(frame: UIScreen.main.bounds) 40 | 41 | tableView = UITableView() 42 | tableView.dataSource = self 43 | tableView.delegate = self 44 | addSubview(tableView) 45 | tableView.snp_makeConstraints { (make) -> Void in 46 | make.top.equalTo(0) 47 | make.left.equalTo(0) 48 | make.width.equalTo(self.snp_width) 49 | make.height.equalTo(self.snp_height) 50 | } 51 | 52 | tableView.register(ExampleViewCell.self, forCellReuseIdentifier: "ExampleViewCell") 53 | } 54 | 55 | required init?(coder aDecoder: NSCoder) { 56 | fatalError("init(coder:) has not been implemented") 57 | } 58 | 59 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 60 | return items.count 61 | } 62 | 63 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 64 | let cell = tableView.dequeueReusableCell(withIdentifier: "ExampleViewCell") as! ExampleViewCell 65 | 66 | cell.textLabel?.text = items[(indexPath as NSIndexPath).item] 67 | 68 | return cell 69 | } 70 | 71 | func tableView(_ tableView: UITableView, didHighlightRowAt indexPath: IndexPath) { 72 | let item = (indexPath as NSIndexPath).item 73 | 74 | if item == 0 { 75 | viewPusher(SimpleKeyValueViewController()) 76 | } else if item == 1 { 77 | // viewPusher(SimpleCollectionViewController()) 78 | } 79 | } 80 | } 81 | 82 | class ExampleViewCell : UITableViewCell { 83 | 84 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 85 | super.init(style: style, reuseIdentifier: reuseIdentifier) 86 | } 87 | 88 | required init?(coder aDecoder: NSCoder) { 89 | fatalError("init(coder:) has not been implemented") 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 2 | 3 | ### SwiftStore ### 4 | Key/Value store for Swift backed by LevelDB. 5 | 6 | ### Usage ### 7 | 8 | #### Create instances of store #### 9 | 10 | ```swift 11 | import SwiftStore 12 | 13 | // Create a store. 14 | let store = SwiftStore(storeName: "db") 15 | 16 | // Write value 17 | store["username"] = "jondoe" 18 | store["auth-token"] = "cdfsd1231sdf12321" 19 | 20 | // Get value 21 | let username = store["username"]! 22 | if !username.isEmpty { 23 | println(username) 24 | } 25 | 26 | let authToken = store["auth-token"]! 27 | if !authToken.isEmpty { 28 | println(authToken) 29 | } 30 | ``` 31 | 32 | #### As Singleton #### 33 | 34 | ```swift 35 | class DB : SwiftStore { 36 | /* Shared Instance */ 37 | static let store = DB() 38 | 39 | init() { 40 | super.init(storeName: "db") 41 | } 42 | 43 | override func close() { 44 | super.close() 45 | } 46 | } 47 | 48 | DB.store["username"] = "jondoe" 49 | DB.store["auth-token"] = "1231sdfjl123" 50 | ``` 51 | 52 | ### Installation ### 53 | 54 | #### Carthage #### 55 | * Add ```github "hemantasapkota/SwiftStore"``` to your ```cartfile``` 56 | * Execute ```carthage update``` 57 | 58 | #### Manual Installation #### 59 | * Clone this repo: ```git clone https://github.com/hemantasapkota/SwiftStore/``` 60 | * Copy ```SwiftStore.xcodeproj``` to your project. 61 | * Add ```SwiftStore.framework``` to the **Embedded Binaries** secion on the **General** tab of your main target. 62 | 63 | ### LevelDB Update ### 64 | 65 | This project has been updated to use the latest version of LevelDB from Google's official repository. The integration has been modernized to use XCFramework for better multi-architecture support. See [LEVELDB_UPDATE.md](LEVELDB_UPDATE.md) for details. 66 | 67 | ### License ### 68 | The MIT License (MIT) 69 | 70 | Copyright (c) 2022 Hemanta Sapkota 71 | 72 | Permission is hereby granted, free of charge, to any person obtaining a copy 73 | of this software and associated documentation files (the "Software"), to deal 74 | in the Software without restriction, including without limitation the rights 75 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 76 | copies of the Software, and to permit persons to whom the Software is 77 | furnished to do so, subject to the following conditions: 78 | 79 | The above copyright notice and this permission notice shall be included in all 80 | copies or substantial portions of the Software. 81 | 82 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 83 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 84 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 85 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 86 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 87 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 88 | SOFTWARE. 89 | 90 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/filter_policy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A database can be configured with a custom FilterPolicy object. 6 | // This object is responsible for creating a small filter from a set 7 | // of keys. These filters are stored in leveldb and are consulted 8 | // automatically by leveldb to decide whether or not to read some 9 | // information from disk. In many cases, a filter can cut down the 10 | // number of disk seeks form a handful to a single disk seek per 11 | // DB::Get() call. 12 | // 13 | // Most people will want to use the builtin bloom filter support (see 14 | // NewBloomFilterPolicy() below). 15 | 16 | #ifndef STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 17 | #define STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 18 | 19 | #include 20 | 21 | #include "leveldb/export.h" 22 | 23 | namespace leveldb { 24 | 25 | class Slice; 26 | 27 | class LEVELDB_EXPORT FilterPolicy { 28 | public: 29 | virtual ~FilterPolicy(); 30 | 31 | // Return the name of this policy. Note that if the filter encoding 32 | // changes in an incompatible way, the name returned by this method 33 | // must be changed. Otherwise, old incompatible filters may be 34 | // passed to methods of this type. 35 | virtual const char* Name() const = 0; 36 | 37 | // keys[0,n-1] contains a list of keys (potentially with duplicates) 38 | // that are ordered according to the user supplied comparator. 39 | // Append a filter that summarizes keys[0,n-1] to *dst. 40 | // 41 | // Warning: do not change the initial contents of *dst. Instead, 42 | // append the newly constructed filter to *dst. 43 | virtual void CreateFilter(const Slice* keys, int n, 44 | std::string* dst) const = 0; 45 | 46 | // "filter" contains the data appended by a preceding call to 47 | // CreateFilter() on this class. This method must return true if 48 | // the key was in the list of keys passed to CreateFilter(). 49 | // This method may return true or false if the key was not on the 50 | // list, but it should aim to return false with a high probability. 51 | virtual bool KeyMayMatch(const Slice& key, const Slice& filter) const = 0; 52 | }; 53 | 54 | // Return a new filter policy that uses a bloom filter with approximately 55 | // the specified number of bits per key. A good value for bits_per_key 56 | // is 10, which yields a filter with ~ 1% false positive rate. 57 | // 58 | // Callers must delete the result after any database that is using the 59 | // result has been closed. 60 | // 61 | // Note: if you are using a custom comparator that ignores some parts 62 | // of the keys being compared, you must not use NewBloomFilterPolicy() 63 | // and must provide your own FilterPolicy that also ignores the 64 | // corresponding parts of the keys. For example, if the comparator 65 | // ignores trailing spaces, it would be incorrect to use a 66 | // FilterPolicy (like NewBloomFilterPolicy) that does not ignore 67 | // trailing spaces in keys. 68 | LEVELDB_EXPORT const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); 69 | 70 | } // namespace leveldb 71 | 72 | #endif // STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 73 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/filter_policy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A database can be configured with a custom FilterPolicy object. 6 | // This object is responsible for creating a small filter from a set 7 | // of keys. These filters are stored in leveldb and are consulted 8 | // automatically by leveldb to decide whether or not to read some 9 | // information from disk. In many cases, a filter can cut down the 10 | // number of disk seeks form a handful to a single disk seek per 11 | // DB::Get() call. 12 | // 13 | // Most people will want to use the builtin bloom filter support (see 14 | // NewBloomFilterPolicy() below). 15 | 16 | #ifndef STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 17 | #define STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 18 | 19 | #include 20 | 21 | #include "leveldb/export.h" 22 | 23 | namespace leveldb { 24 | 25 | class Slice; 26 | 27 | class LEVELDB_EXPORT FilterPolicy { 28 | public: 29 | virtual ~FilterPolicy(); 30 | 31 | // Return the name of this policy. Note that if the filter encoding 32 | // changes in an incompatible way, the name returned by this method 33 | // must be changed. Otherwise, old incompatible filters may be 34 | // passed to methods of this type. 35 | virtual const char* Name() const = 0; 36 | 37 | // keys[0,n-1] contains a list of keys (potentially with duplicates) 38 | // that are ordered according to the user supplied comparator. 39 | // Append a filter that summarizes keys[0,n-1] to *dst. 40 | // 41 | // Warning: do not change the initial contents of *dst. Instead, 42 | // append the newly constructed filter to *dst. 43 | virtual void CreateFilter(const Slice* keys, int n, 44 | std::string* dst) const = 0; 45 | 46 | // "filter" contains the data appended by a preceding call to 47 | // CreateFilter() on this class. This method must return true if 48 | // the key was in the list of keys passed to CreateFilter(). 49 | // This method may return true or false if the key was not on the 50 | // list, but it should aim to return false with a high probability. 51 | virtual bool KeyMayMatch(const Slice& key, const Slice& filter) const = 0; 52 | }; 53 | 54 | // Return a new filter policy that uses a bloom filter with approximately 55 | // the specified number of bits per key. A good value for bits_per_key 56 | // is 10, which yields a filter with ~ 1% false positive rate. 57 | // 58 | // Callers must delete the result after any database that is using the 59 | // result has been closed. 60 | // 61 | // Note: if you are using a custom comparator that ignores some parts 62 | // of the keys being compared, you must not use NewBloomFilterPolicy() 63 | // and must provide your own FilterPolicy that also ignores the 64 | // corresponding parts of the keys. For example, if the comparator 65 | // ignores trailing spaces, it would be incorrect to use a 66 | // FilterPolicy (like NewBloomFilterPolicy) that does not ignore 67 | // trailing spaces in keys. 68 | LEVELDB_EXPORT const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); 69 | 70 | } // namespace leveldb 71 | 72 | #endif // STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 73 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/filter_policy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A database can be configured with a custom FilterPolicy object. 6 | // This object is responsible for creating a small filter from a set 7 | // of keys. These filters are stored in leveldb and are consulted 8 | // automatically by leveldb to decide whether or not to read some 9 | // information from disk. In many cases, a filter can cut down the 10 | // number of disk seeks form a handful to a single disk seek per 11 | // DB::Get() call. 12 | // 13 | // Most people will want to use the builtin bloom filter support (see 14 | // NewBloomFilterPolicy() below). 15 | 16 | #ifndef STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 17 | #define STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 18 | 19 | #include 20 | 21 | #include "leveldb/export.h" 22 | 23 | namespace leveldb { 24 | 25 | class Slice; 26 | 27 | class LEVELDB_EXPORT FilterPolicy { 28 | public: 29 | virtual ~FilterPolicy(); 30 | 31 | // Return the name of this policy. Note that if the filter encoding 32 | // changes in an incompatible way, the name returned by this method 33 | // must be changed. Otherwise, old incompatible filters may be 34 | // passed to methods of this type. 35 | virtual const char* Name() const = 0; 36 | 37 | // keys[0,n-1] contains a list of keys (potentially with duplicates) 38 | // that are ordered according to the user supplied comparator. 39 | // Append a filter that summarizes keys[0,n-1] to *dst. 40 | // 41 | // Warning: do not change the initial contents of *dst. Instead, 42 | // append the newly constructed filter to *dst. 43 | virtual void CreateFilter(const Slice* keys, int n, 44 | std::string* dst) const = 0; 45 | 46 | // "filter" contains the data appended by a preceding call to 47 | // CreateFilter() on this class. This method must return true if 48 | // the key was in the list of keys passed to CreateFilter(). 49 | // This method may return true or false if the key was not on the 50 | // list, but it should aim to return false with a high probability. 51 | virtual bool KeyMayMatch(const Slice& key, const Slice& filter) const = 0; 52 | }; 53 | 54 | // Return a new filter policy that uses a bloom filter with approximately 55 | // the specified number of bits per key. A good value for bits_per_key 56 | // is 10, which yields a filter with ~ 1% false positive rate. 57 | // 58 | // Callers must delete the result after any database that is using the 59 | // result has been closed. 60 | // 61 | // Note: if you are using a custom comparator that ignores some parts 62 | // of the keys being compared, you must not use NewBloomFilterPolicy() 63 | // and must provide your own FilterPolicy that also ignores the 64 | // corresponding parts of the keys. For example, if the comparator 65 | // ignores trailing spaces, it would be incorrect to use a 66 | // FilterPolicy (like NewBloomFilterPolicy) that does not ignore 67 | // trailing spaces in keys. 68 | LEVELDB_EXPORT const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); 69 | 70 | } // namespace leveldb 71 | 72 | #endif // STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 73 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/filter_policy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A database can be configured with a custom FilterPolicy object. 6 | // This object is responsible for creating a small filter from a set 7 | // of keys. These filters are stored in leveldb and are consulted 8 | // automatically by leveldb to decide whether or not to read some 9 | // information from disk. In many cases, a filter can cut down the 10 | // number of disk seeks form a handful to a single disk seek per 11 | // DB::Get() call. 12 | // 13 | // Most people will want to use the builtin bloom filter support (see 14 | // NewBloomFilterPolicy() below). 15 | 16 | #ifndef STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 17 | #define STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 18 | 19 | #include 20 | 21 | #include "leveldb/export.h" 22 | 23 | namespace leveldb { 24 | 25 | class Slice; 26 | 27 | class LEVELDB_EXPORT FilterPolicy { 28 | public: 29 | virtual ~FilterPolicy(); 30 | 31 | // Return the name of this policy. Note that if the filter encoding 32 | // changes in an incompatible way, the name returned by this method 33 | // must be changed. Otherwise, old incompatible filters may be 34 | // passed to methods of this type. 35 | virtual const char* Name() const = 0; 36 | 37 | // keys[0,n-1] contains a list of keys (potentially with duplicates) 38 | // that are ordered according to the user supplied comparator. 39 | // Append a filter that summarizes keys[0,n-1] to *dst. 40 | // 41 | // Warning: do not change the initial contents of *dst. Instead, 42 | // append the newly constructed filter to *dst. 43 | virtual void CreateFilter(const Slice* keys, int n, 44 | std::string* dst) const = 0; 45 | 46 | // "filter" contains the data appended by a preceding call to 47 | // CreateFilter() on this class. This method must return true if 48 | // the key was in the list of keys passed to CreateFilter(). 49 | // This method may return true or false if the key was not on the 50 | // list, but it should aim to return false with a high probability. 51 | virtual bool KeyMayMatch(const Slice& key, const Slice& filter) const = 0; 52 | }; 53 | 54 | // Return a new filter policy that uses a bloom filter with approximately 55 | // the specified number of bits per key. A good value for bits_per_key 56 | // is 10, which yields a filter with ~ 1% false positive rate. 57 | // 58 | // Callers must delete the result after any database that is using the 59 | // result has been closed. 60 | // 61 | // Note: if you are using a custom comparator that ignores some parts 62 | // of the keys being compared, you must not use NewBloomFilterPolicy() 63 | // and must provide your own FilterPolicy that also ignores the 64 | // corresponding parts of the keys. For example, if the comparator 65 | // ignores trailing spaces, it would be incorrect to use a 66 | // FilterPolicy (like NewBloomFilterPolicy) that does not ignore 67 | // trailing spaces in keys. 68 | LEVELDB_EXPORT const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); 69 | 70 | } // namespace leveldb 71 | 72 | #endif // STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 73 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/filter_policy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A database can be configured with a custom FilterPolicy object. 6 | // This object is responsible for creating a small filter from a set 7 | // of keys. These filters are stored in leveldb and are consulted 8 | // automatically by leveldb to decide whether or not to read some 9 | // information from disk. In many cases, a filter can cut down the 10 | // number of disk seeks form a handful to a single disk seek per 11 | // DB::Get() call. 12 | // 13 | // Most people will want to use the builtin bloom filter support (see 14 | // NewBloomFilterPolicy() below). 15 | 16 | #ifndef STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 17 | #define STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 18 | 19 | #include 20 | 21 | #include "leveldb/export.h" 22 | 23 | namespace leveldb { 24 | 25 | class Slice; 26 | 27 | class LEVELDB_EXPORT FilterPolicy { 28 | public: 29 | virtual ~FilterPolicy(); 30 | 31 | // Return the name of this policy. Note that if the filter encoding 32 | // changes in an incompatible way, the name returned by this method 33 | // must be changed. Otherwise, old incompatible filters may be 34 | // passed to methods of this type. 35 | virtual const char* Name() const = 0; 36 | 37 | // keys[0,n-1] contains a list of keys (potentially with duplicates) 38 | // that are ordered according to the user supplied comparator. 39 | // Append a filter that summarizes keys[0,n-1] to *dst. 40 | // 41 | // Warning: do not change the initial contents of *dst. Instead, 42 | // append the newly constructed filter to *dst. 43 | virtual void CreateFilter(const Slice* keys, int n, 44 | std::string* dst) const = 0; 45 | 46 | // "filter" contains the data appended by a preceding call to 47 | // CreateFilter() on this class. This method must return true if 48 | // the key was in the list of keys passed to CreateFilter(). 49 | // This method may return true or false if the key was not on the 50 | // list, but it should aim to return false with a high probability. 51 | virtual bool KeyMayMatch(const Slice& key, const Slice& filter) const = 0; 52 | }; 53 | 54 | // Return a new filter policy that uses a bloom filter with approximately 55 | // the specified number of bits per key. A good value for bits_per_key 56 | // is 10, which yields a filter with ~ 1% false positive rate. 57 | // 58 | // Callers must delete the result after any database that is using the 59 | // result has been closed. 60 | // 61 | // Note: if you are using a custom comparator that ignores some parts 62 | // of the keys being compared, you must not use NewBloomFilterPolicy() 63 | // and must provide your own FilterPolicy that also ignores the 64 | // corresponding parts of the keys. For example, if the comparator 65 | // ignores trailing spaces, it would be incorrect to use a 66 | // FilterPolicy (like NewBloomFilterPolicy) that does not ignore 67 | // trailing spaces in keys. 68 | LEVELDB_EXPORT const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); 69 | 70 | } // namespace leveldb 71 | 72 | #endif // STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 73 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/filter_policy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A database can be configured with a custom FilterPolicy object. 6 | // This object is responsible for creating a small filter from a set 7 | // of keys. These filters are stored in leveldb and are consulted 8 | // automatically by leveldb to decide whether or not to read some 9 | // information from disk. In many cases, a filter can cut down the 10 | // number of disk seeks form a handful to a single disk seek per 11 | // DB::Get() call. 12 | // 13 | // Most people will want to use the builtin bloom filter support (see 14 | // NewBloomFilterPolicy() below). 15 | 16 | #ifndef STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 17 | #define STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 18 | 19 | #include 20 | 21 | #include "leveldb/export.h" 22 | 23 | namespace leveldb { 24 | 25 | class Slice; 26 | 27 | class LEVELDB_EXPORT FilterPolicy { 28 | public: 29 | virtual ~FilterPolicy(); 30 | 31 | // Return the name of this policy. Note that if the filter encoding 32 | // changes in an incompatible way, the name returned by this method 33 | // must be changed. Otherwise, old incompatible filters may be 34 | // passed to methods of this type. 35 | virtual const char* Name() const = 0; 36 | 37 | // keys[0,n-1] contains a list of keys (potentially with duplicates) 38 | // that are ordered according to the user supplied comparator. 39 | // Append a filter that summarizes keys[0,n-1] to *dst. 40 | // 41 | // Warning: do not change the initial contents of *dst. Instead, 42 | // append the newly constructed filter to *dst. 43 | virtual void CreateFilter(const Slice* keys, int n, 44 | std::string* dst) const = 0; 45 | 46 | // "filter" contains the data appended by a preceding call to 47 | // CreateFilter() on this class. This method must return true if 48 | // the key was in the list of keys passed to CreateFilter(). 49 | // This method may return true or false if the key was not on the 50 | // list, but it should aim to return false with a high probability. 51 | virtual bool KeyMayMatch(const Slice& key, const Slice& filter) const = 0; 52 | }; 53 | 54 | // Return a new filter policy that uses a bloom filter with approximately 55 | // the specified number of bits per key. A good value for bits_per_key 56 | // is 10, which yields a filter with ~ 1% false positive rate. 57 | // 58 | // Callers must delete the result after any database that is using the 59 | // result has been closed. 60 | // 61 | // Note: if you are using a custom comparator that ignores some parts 62 | // of the keys being compared, you must not use NewBloomFilterPolicy() 63 | // and must provide your own FilterPolicy that also ignores the 64 | // corresponding parts of the keys. For example, if the comparator 65 | // ignores trailing spaces, it would be incorrect to use a 66 | // FilterPolicy (like NewBloomFilterPolicy) that does not ignore 67 | // trailing spaces in keys. 68 | LEVELDB_EXPORT const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); 69 | 70 | } // namespace leveldb 71 | 72 | #endif // STORAGE_LEVELDB_INCLUDE_FILTER_POLICY_H_ 73 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/table.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_TABLE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | #include "leveldb/iterator.h" 12 | 13 | namespace leveldb { 14 | 15 | class Block; 16 | class BlockHandle; 17 | class Footer; 18 | struct Options; 19 | class RandomAccessFile; 20 | struct ReadOptions; 21 | class TableCache; 22 | 23 | // A Table is a sorted map from strings to strings. Tables are 24 | // immutable and persistent. A Table may be safely accessed from 25 | // multiple threads without external synchronization. 26 | class LEVELDB_EXPORT Table { 27 | public: 28 | // Attempt to open the table that is stored in bytes [0..file_size) 29 | // of "file", and read the metadata entries necessary to allow 30 | // retrieving data from the table. 31 | // 32 | // If successful, returns ok and sets "*table" to the newly opened 33 | // table. The client should delete "*table" when no longer needed. 34 | // If there was an error while initializing the table, sets "*table" 35 | // to nullptr and returns a non-ok status. Does not take ownership of 36 | // "*source", but the client must ensure that "source" remains live 37 | // for the duration of the returned table's lifetime. 38 | // 39 | // *file must remain live while this Table is in use. 40 | static Status Open(const Options& options, RandomAccessFile* file, 41 | uint64_t file_size, Table** table); 42 | 43 | Table(const Table&) = delete; 44 | Table& operator=(const Table&) = delete; 45 | 46 | ~Table(); 47 | 48 | // Returns a new iterator over the table contents. 49 | // The result of NewIterator() is initially invalid (caller must 50 | // call one of the Seek methods on the iterator before using it). 51 | Iterator* NewIterator(const ReadOptions&) const; 52 | 53 | // Given a key, return an approximate byte offset in the file where 54 | // the data for that key begins (or would begin if the key were 55 | // present in the file). The returned value is in terms of file 56 | // bytes, and so includes effects like compression of the underlying data. 57 | // E.g., the approximate offset of the last key in the table will 58 | // be close to the file length. 59 | uint64_t ApproximateOffsetOf(const Slice& key) const; 60 | 61 | private: 62 | friend class TableCache; 63 | struct Rep; 64 | 65 | static Iterator* BlockReader(void*, const ReadOptions&, const Slice&); 66 | 67 | explicit Table(Rep* rep) : rep_(rep) {} 68 | 69 | // Calls (*handle_result)(arg, ...) with the entry found after a call 70 | // to Seek(key). May not make such a call if filter policy says 71 | // that key is not present. 72 | Status InternalGet(const ReadOptions&, const Slice& key, void* arg, 73 | void (*handle_result)(void* arg, const Slice& k, 74 | const Slice& v)); 75 | 76 | void ReadMeta(const Footer& footer); 77 | void ReadFilter(const Slice& filter_handle_value); 78 | 79 | Rep* const rep_; 80 | }; 81 | 82 | } // namespace leveldb 83 | 84 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_H_ 85 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/table.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_TABLE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | #include "leveldb/iterator.h" 12 | 13 | namespace leveldb { 14 | 15 | class Block; 16 | class BlockHandle; 17 | class Footer; 18 | struct Options; 19 | class RandomAccessFile; 20 | struct ReadOptions; 21 | class TableCache; 22 | 23 | // A Table is a sorted map from strings to strings. Tables are 24 | // immutable and persistent. A Table may be safely accessed from 25 | // multiple threads without external synchronization. 26 | class LEVELDB_EXPORT Table { 27 | public: 28 | // Attempt to open the table that is stored in bytes [0..file_size) 29 | // of "file", and read the metadata entries necessary to allow 30 | // retrieving data from the table. 31 | // 32 | // If successful, returns ok and sets "*table" to the newly opened 33 | // table. The client should delete "*table" when no longer needed. 34 | // If there was an error while initializing the table, sets "*table" 35 | // to nullptr and returns a non-ok status. Does not take ownership of 36 | // "*source", but the client must ensure that "source" remains live 37 | // for the duration of the returned table's lifetime. 38 | // 39 | // *file must remain live while this Table is in use. 40 | static Status Open(const Options& options, RandomAccessFile* file, 41 | uint64_t file_size, Table** table); 42 | 43 | Table(const Table&) = delete; 44 | Table& operator=(const Table&) = delete; 45 | 46 | ~Table(); 47 | 48 | // Returns a new iterator over the table contents. 49 | // The result of NewIterator() is initially invalid (caller must 50 | // call one of the Seek methods on the iterator before using it). 51 | Iterator* NewIterator(const ReadOptions&) const; 52 | 53 | // Given a key, return an approximate byte offset in the file where 54 | // the data for that key begins (or would begin if the key were 55 | // present in the file). The returned value is in terms of file 56 | // bytes, and so includes effects like compression of the underlying data. 57 | // E.g., the approximate offset of the last key in the table will 58 | // be close to the file length. 59 | uint64_t ApproximateOffsetOf(const Slice& key) const; 60 | 61 | private: 62 | friend class TableCache; 63 | struct Rep; 64 | 65 | static Iterator* BlockReader(void*, const ReadOptions&, const Slice&); 66 | 67 | explicit Table(Rep* rep) : rep_(rep) {} 68 | 69 | // Calls (*handle_result)(arg, ...) with the entry found after a call 70 | // to Seek(key). May not make such a call if filter policy says 71 | // that key is not present. 72 | Status InternalGet(const ReadOptions&, const Slice& key, void* arg, 73 | void (*handle_result)(void* arg, const Slice& k, 74 | const Slice& v)); 75 | 76 | void ReadMeta(const Footer& footer); 77 | void ReadFilter(const Slice& filter_handle_value); 78 | 79 | Rep* const rep_; 80 | }; 81 | 82 | } // namespace leveldb 83 | 84 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_H_ 85 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/table.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_TABLE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | #include "leveldb/iterator.h" 12 | 13 | namespace leveldb { 14 | 15 | class Block; 16 | class BlockHandle; 17 | class Footer; 18 | struct Options; 19 | class RandomAccessFile; 20 | struct ReadOptions; 21 | class TableCache; 22 | 23 | // A Table is a sorted map from strings to strings. Tables are 24 | // immutable and persistent. A Table may be safely accessed from 25 | // multiple threads without external synchronization. 26 | class LEVELDB_EXPORT Table { 27 | public: 28 | // Attempt to open the table that is stored in bytes [0..file_size) 29 | // of "file", and read the metadata entries necessary to allow 30 | // retrieving data from the table. 31 | // 32 | // If successful, returns ok and sets "*table" to the newly opened 33 | // table. The client should delete "*table" when no longer needed. 34 | // If there was an error while initializing the table, sets "*table" 35 | // to nullptr and returns a non-ok status. Does not take ownership of 36 | // "*source", but the client must ensure that "source" remains live 37 | // for the duration of the returned table's lifetime. 38 | // 39 | // *file must remain live while this Table is in use. 40 | static Status Open(const Options& options, RandomAccessFile* file, 41 | uint64_t file_size, Table** table); 42 | 43 | Table(const Table&) = delete; 44 | Table& operator=(const Table&) = delete; 45 | 46 | ~Table(); 47 | 48 | // Returns a new iterator over the table contents. 49 | // The result of NewIterator() is initially invalid (caller must 50 | // call one of the Seek methods on the iterator before using it). 51 | Iterator* NewIterator(const ReadOptions&) const; 52 | 53 | // Given a key, return an approximate byte offset in the file where 54 | // the data for that key begins (or would begin if the key were 55 | // present in the file). The returned value is in terms of file 56 | // bytes, and so includes effects like compression of the underlying data. 57 | // E.g., the approximate offset of the last key in the table will 58 | // be close to the file length. 59 | uint64_t ApproximateOffsetOf(const Slice& key) const; 60 | 61 | private: 62 | friend class TableCache; 63 | struct Rep; 64 | 65 | static Iterator* BlockReader(void*, const ReadOptions&, const Slice&); 66 | 67 | explicit Table(Rep* rep) : rep_(rep) {} 68 | 69 | // Calls (*handle_result)(arg, ...) with the entry found after a call 70 | // to Seek(key). May not make such a call if filter policy says 71 | // that key is not present. 72 | Status InternalGet(const ReadOptions&, const Slice& key, void* arg, 73 | void (*handle_result)(void* arg, const Slice& k, 74 | const Slice& v)); 75 | 76 | void ReadMeta(const Footer& footer); 77 | void ReadFilter(const Slice& filter_handle_value); 78 | 79 | Rep* const rep_; 80 | }; 81 | 82 | } // namespace leveldb 83 | 84 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_H_ 85 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/table.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_TABLE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | #include "leveldb/iterator.h" 12 | 13 | namespace leveldb { 14 | 15 | class Block; 16 | class BlockHandle; 17 | class Footer; 18 | struct Options; 19 | class RandomAccessFile; 20 | struct ReadOptions; 21 | class TableCache; 22 | 23 | // A Table is a sorted map from strings to strings. Tables are 24 | // immutable and persistent. A Table may be safely accessed from 25 | // multiple threads without external synchronization. 26 | class LEVELDB_EXPORT Table { 27 | public: 28 | // Attempt to open the table that is stored in bytes [0..file_size) 29 | // of "file", and read the metadata entries necessary to allow 30 | // retrieving data from the table. 31 | // 32 | // If successful, returns ok and sets "*table" to the newly opened 33 | // table. The client should delete "*table" when no longer needed. 34 | // If there was an error while initializing the table, sets "*table" 35 | // to nullptr and returns a non-ok status. Does not take ownership of 36 | // "*source", but the client must ensure that "source" remains live 37 | // for the duration of the returned table's lifetime. 38 | // 39 | // *file must remain live while this Table is in use. 40 | static Status Open(const Options& options, RandomAccessFile* file, 41 | uint64_t file_size, Table** table); 42 | 43 | Table(const Table&) = delete; 44 | Table& operator=(const Table&) = delete; 45 | 46 | ~Table(); 47 | 48 | // Returns a new iterator over the table contents. 49 | // The result of NewIterator() is initially invalid (caller must 50 | // call one of the Seek methods on the iterator before using it). 51 | Iterator* NewIterator(const ReadOptions&) const; 52 | 53 | // Given a key, return an approximate byte offset in the file where 54 | // the data for that key begins (or would begin if the key were 55 | // present in the file). The returned value is in terms of file 56 | // bytes, and so includes effects like compression of the underlying data. 57 | // E.g., the approximate offset of the last key in the table will 58 | // be close to the file length. 59 | uint64_t ApproximateOffsetOf(const Slice& key) const; 60 | 61 | private: 62 | friend class TableCache; 63 | struct Rep; 64 | 65 | static Iterator* BlockReader(void*, const ReadOptions&, const Slice&); 66 | 67 | explicit Table(Rep* rep) : rep_(rep) {} 68 | 69 | // Calls (*handle_result)(arg, ...) with the entry found after a call 70 | // to Seek(key). May not make such a call if filter policy says 71 | // that key is not present. 72 | Status InternalGet(const ReadOptions&, const Slice& key, void* arg, 73 | void (*handle_result)(void* arg, const Slice& k, 74 | const Slice& v)); 75 | 76 | void ReadMeta(const Footer& footer); 77 | void ReadFilter(const Slice& filter_handle_value); 78 | 79 | Rep* const rep_; 80 | }; 81 | 82 | } // namespace leveldb 83 | 84 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_H_ 85 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/table.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_TABLE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | #include "leveldb/iterator.h" 12 | 13 | namespace leveldb { 14 | 15 | class Block; 16 | class BlockHandle; 17 | class Footer; 18 | struct Options; 19 | class RandomAccessFile; 20 | struct ReadOptions; 21 | class TableCache; 22 | 23 | // A Table is a sorted map from strings to strings. Tables are 24 | // immutable and persistent. A Table may be safely accessed from 25 | // multiple threads without external synchronization. 26 | class LEVELDB_EXPORT Table { 27 | public: 28 | // Attempt to open the table that is stored in bytes [0..file_size) 29 | // of "file", and read the metadata entries necessary to allow 30 | // retrieving data from the table. 31 | // 32 | // If successful, returns ok and sets "*table" to the newly opened 33 | // table. The client should delete "*table" when no longer needed. 34 | // If there was an error while initializing the table, sets "*table" 35 | // to nullptr and returns a non-ok status. Does not take ownership of 36 | // "*source", but the client must ensure that "source" remains live 37 | // for the duration of the returned table's lifetime. 38 | // 39 | // *file must remain live while this Table is in use. 40 | static Status Open(const Options& options, RandomAccessFile* file, 41 | uint64_t file_size, Table** table); 42 | 43 | Table(const Table&) = delete; 44 | Table& operator=(const Table&) = delete; 45 | 46 | ~Table(); 47 | 48 | // Returns a new iterator over the table contents. 49 | // The result of NewIterator() is initially invalid (caller must 50 | // call one of the Seek methods on the iterator before using it). 51 | Iterator* NewIterator(const ReadOptions&) const; 52 | 53 | // Given a key, return an approximate byte offset in the file where 54 | // the data for that key begins (or would begin if the key were 55 | // present in the file). The returned value is in terms of file 56 | // bytes, and so includes effects like compression of the underlying data. 57 | // E.g., the approximate offset of the last key in the table will 58 | // be close to the file length. 59 | uint64_t ApproximateOffsetOf(const Slice& key) const; 60 | 61 | private: 62 | friend class TableCache; 63 | struct Rep; 64 | 65 | static Iterator* BlockReader(void*, const ReadOptions&, const Slice&); 66 | 67 | explicit Table(Rep* rep) : rep_(rep) {} 68 | 69 | // Calls (*handle_result)(arg, ...) with the entry found after a call 70 | // to Seek(key). May not make such a call if filter policy says 71 | // that key is not present. 72 | Status InternalGet(const ReadOptions&, const Slice& key, void* arg, 73 | void (*handle_result)(void* arg, const Slice& k, 74 | const Slice& v)); 75 | 76 | void ReadMeta(const Footer& footer); 77 | void ReadFilter(const Slice& filter_handle_value); 78 | 79 | Rep* const rep_; 80 | }; 81 | 82 | } // namespace leveldb 83 | 84 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_H_ 85 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/table.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_ 6 | #define STORAGE_LEVELDB_INCLUDE_TABLE_H_ 7 | 8 | #include 9 | 10 | #include "leveldb/export.h" 11 | #include "leveldb/iterator.h" 12 | 13 | namespace leveldb { 14 | 15 | class Block; 16 | class BlockHandle; 17 | class Footer; 18 | struct Options; 19 | class RandomAccessFile; 20 | struct ReadOptions; 21 | class TableCache; 22 | 23 | // A Table is a sorted map from strings to strings. Tables are 24 | // immutable and persistent. A Table may be safely accessed from 25 | // multiple threads without external synchronization. 26 | class LEVELDB_EXPORT Table { 27 | public: 28 | // Attempt to open the table that is stored in bytes [0..file_size) 29 | // of "file", and read the metadata entries necessary to allow 30 | // retrieving data from the table. 31 | // 32 | // If successful, returns ok and sets "*table" to the newly opened 33 | // table. The client should delete "*table" when no longer needed. 34 | // If there was an error while initializing the table, sets "*table" 35 | // to nullptr and returns a non-ok status. Does not take ownership of 36 | // "*source", but the client must ensure that "source" remains live 37 | // for the duration of the returned table's lifetime. 38 | // 39 | // *file must remain live while this Table is in use. 40 | static Status Open(const Options& options, RandomAccessFile* file, 41 | uint64_t file_size, Table** table); 42 | 43 | Table(const Table&) = delete; 44 | Table& operator=(const Table&) = delete; 45 | 46 | ~Table(); 47 | 48 | // Returns a new iterator over the table contents. 49 | // The result of NewIterator() is initially invalid (caller must 50 | // call one of the Seek methods on the iterator before using it). 51 | Iterator* NewIterator(const ReadOptions&) const; 52 | 53 | // Given a key, return an approximate byte offset in the file where 54 | // the data for that key begins (or would begin if the key were 55 | // present in the file). The returned value is in terms of file 56 | // bytes, and so includes effects like compression of the underlying data. 57 | // E.g., the approximate offset of the last key in the table will 58 | // be close to the file length. 59 | uint64_t ApproximateOffsetOf(const Slice& key) const; 60 | 61 | private: 62 | friend class TableCache; 63 | struct Rep; 64 | 65 | static Iterator* BlockReader(void*, const ReadOptions&, const Slice&); 66 | 67 | explicit Table(Rep* rep) : rep_(rep) {} 68 | 69 | // Calls (*handle_result)(arg, ...) with the entry found after a call 70 | // to Seek(key). May not make such a call if filter policy says 71 | // that key is not present. 72 | Status InternalGet(const ReadOptions&, const Slice& key, void* arg, 73 | void (*handle_result)(void* arg, const Slice& k, 74 | const Slice& v)); 75 | 76 | void ReadMeta(const Footer& footer); 77 | void ReadFilter(const Slice& filter_handle_value); 78 | 79 | Rep* const rep_; 80 | }; 81 | 82 | } // namespace leveldb 83 | 84 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_H_ 85 | -------------------------------------------------------------------------------- /docs/LEVELDB_UPDATE.md: -------------------------------------------------------------------------------- 1 | # LevelDB Update 2 | 3 | This repository previously used an older version of LevelDB. The code has been updated to use the latest version of LevelDB from the official Google repository. 4 | 5 | ## Changes Made 6 | 7 | 1. The latest LevelDB source code was obtained from [Google's LevelDB repository](https://github.com/google/leveldb) 8 | 2. A custom build script was created to compile LevelDB for multiple platforms and architectures: 9 | - iOS (arm64) 10 | - iOS Simulator (arm64, x86_64) 11 | - macOS (arm64, x86_64) 12 | 3. An XCFramework was created that packages all these binaries together for seamless integration with Xcode 13 | 14 | ## Benefits of the Update 15 | 16 | - Latest LevelDB features and bug fixes 17 | - Improved performance 18 | - Proper multi-architecture support 19 | - Better Xcode integration using XCFramework 20 | - Makes it easier to update LevelDB in the future 21 | 22 | ## How to Build the LevelDB XCFramework 23 | 24 | If you need to rebuild the LevelDB XCFramework, follow these steps: 25 | 26 | 1. Clone the LevelDB repository: 27 | ```bash 28 | git clone --recurse-submodules https://github.com/google/leveldb.git 29 | ``` 30 | 31 | 2. Use the provided build script from the `leveldb_build` directory: 32 | ```bash 33 | cd leveldb_build 34 | ./build_xcframework.sh 35 | ``` 36 | 37 | 3. The script will: 38 | - Build LevelDB for each platform and architecture 39 | - Create universal binaries for the simulator and macOS 40 | - Generate an XCFramework in the `output` directory 41 | 42 | 4. Copy the XCFramework to your project and update the Xcode project settings 43 | 44 | 5. Run the header fix script to make including headers easier: 45 | ```bash 46 | ./leveldb_build/fix_xcframework_headers.sh 47 | ``` 48 | 49 | ## Updating Xcode Project Settings 50 | 51 | 1. Remove the existing leveldb references from the project navigator 52 | 2. Drag `LevelDB.xcframework` into the project navigator (select "Copy items if needed") 53 | 3. Add `LevelDB.xcframework` to the target's "Frameworks, Libraries, and Embedded Content" section 54 | 4. Update the header search paths in Build Settings: 55 | - Replace `$(SRCROOT)/leveldb/include/` with `$(SRCROOT)/LevelDB.xcframework/Headers` 56 | 5. Remove the `-lleveldb` flag from "Other Linker Flags" 57 | 58 | ## Header Inclusion in Code 59 | 60 | After running the `fix_xcframework_headers.sh` script, LevelDB headers can be included in two ways: 61 | 62 | 1. Simple include (recommended): 63 | ```objc 64 | #import 65 | #import 66 | // etc. 67 | ``` 68 | 69 | 2. Original include structure: 70 | ```objc 71 | #import 72 | #import 73 | // etc. 74 | ``` 75 | 76 | The fix script: 77 | - Copies all headers from the leveldb/ subdirectory to the Headers root 78 | - Creates symbolic links to handle internal includes between header files 79 | - Maintains compatibility with both import styles 80 | 81 | ## Troubleshooting 82 | 83 | If you encounter include path issues where LevelDB headers can't find each other (e.g., a header tries to include "leveldb/export.h" but can't find it), try one of these solutions: 84 | 85 | 1. Make sure the XCFramework is properly linked in the "Frameworks, Libraries, and Embedded Content" section 86 | 2. Verify that your header search paths are correctly set to `$(SRCROOT)/LevelDB.xcframework/Headers` 87 | 3. Run the `./leveldb_build/fix_xcframework_headers.sh` script to fix the header structure -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/table_builder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // TableBuilder provides the interface used to build a Table 6 | // (an immutable and sorted map from keys to values). 7 | // 8 | // Multiple threads can invoke const methods on a TableBuilder without 9 | // external synchronization, but if any of the threads may call a 10 | // non-const method, all threads accessing the same TableBuilder must use 11 | // external synchronization. 12 | 13 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 14 | #define STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 15 | 16 | #include 17 | 18 | #include "leveldb/export.h" 19 | #include "leveldb/options.h" 20 | #include "leveldb/status.h" 21 | 22 | namespace leveldb { 23 | 24 | class BlockBuilder; 25 | class BlockHandle; 26 | class WritableFile; 27 | 28 | class LEVELDB_EXPORT TableBuilder { 29 | public: 30 | // Create a builder that will store the contents of the table it is 31 | // building in *file. Does not close the file. It is up to the 32 | // caller to close the file after calling Finish(). 33 | TableBuilder(const Options& options, WritableFile* file); 34 | 35 | TableBuilder(const TableBuilder&) = delete; 36 | TableBuilder& operator=(const TableBuilder&) = delete; 37 | 38 | // REQUIRES: Either Finish() or Abandon() has been called. 39 | ~TableBuilder(); 40 | 41 | // Change the options used by this builder. Note: only some of the 42 | // option fields can be changed after construction. If a field is 43 | // not allowed to change dynamically and its value in the structure 44 | // passed to the constructor is different from its value in the 45 | // structure passed to this method, this method will return an error 46 | // without changing any fields. 47 | Status ChangeOptions(const Options& options); 48 | 49 | // Add key,value to the table being constructed. 50 | // REQUIRES: key is after any previously added key according to comparator. 51 | // REQUIRES: Finish(), Abandon() have not been called 52 | void Add(const Slice& key, const Slice& value); 53 | 54 | // Advanced operation: flush any buffered key/value pairs to file. 55 | // Can be used to ensure that two adjacent entries never live in 56 | // the same data block. Most clients should not need to use this method. 57 | // REQUIRES: Finish(), Abandon() have not been called 58 | void Flush(); 59 | 60 | // Return non-ok iff some error has been detected. 61 | Status status() const; 62 | 63 | // Finish building the table. Stops using the file passed to the 64 | // constructor after this function returns. 65 | // REQUIRES: Finish(), Abandon() have not been called 66 | Status Finish(); 67 | 68 | // Indicate that the contents of this builder should be abandoned. Stops 69 | // using the file passed to the constructor after this function returns. 70 | // If the caller is not going to call Finish(), it must call Abandon() 71 | // before destroying this builder. 72 | // REQUIRES: Finish(), Abandon() have not been called 73 | void Abandon(); 74 | 75 | // Number of calls to Add() so far. 76 | uint64_t NumEntries() const; 77 | 78 | // Size of the file generated so far. If invoked after a successful 79 | // Finish() call, returns the size of the final generated file. 80 | uint64_t FileSize() const; 81 | 82 | private: 83 | bool ok() const { return status().ok(); } 84 | void WriteBlock(BlockBuilder* block, BlockHandle* handle); 85 | void WriteRawBlock(const Slice& data, CompressionType, BlockHandle* handle); 86 | 87 | struct Rep; 88 | Rep* rep_; 89 | }; 90 | 91 | } // namespace leveldb 92 | 93 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 94 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/table_builder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // TableBuilder provides the interface used to build a Table 6 | // (an immutable and sorted map from keys to values). 7 | // 8 | // Multiple threads can invoke const methods on a TableBuilder without 9 | // external synchronization, but if any of the threads may call a 10 | // non-const method, all threads accessing the same TableBuilder must use 11 | // external synchronization. 12 | 13 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 14 | #define STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 15 | 16 | #include 17 | 18 | #include "leveldb/export.h" 19 | #include "leveldb/options.h" 20 | #include "leveldb/status.h" 21 | 22 | namespace leveldb { 23 | 24 | class BlockBuilder; 25 | class BlockHandle; 26 | class WritableFile; 27 | 28 | class LEVELDB_EXPORT TableBuilder { 29 | public: 30 | // Create a builder that will store the contents of the table it is 31 | // building in *file. Does not close the file. It is up to the 32 | // caller to close the file after calling Finish(). 33 | TableBuilder(const Options& options, WritableFile* file); 34 | 35 | TableBuilder(const TableBuilder&) = delete; 36 | TableBuilder& operator=(const TableBuilder&) = delete; 37 | 38 | // REQUIRES: Either Finish() or Abandon() has been called. 39 | ~TableBuilder(); 40 | 41 | // Change the options used by this builder. Note: only some of the 42 | // option fields can be changed after construction. If a field is 43 | // not allowed to change dynamically and its value in the structure 44 | // passed to the constructor is different from its value in the 45 | // structure passed to this method, this method will return an error 46 | // without changing any fields. 47 | Status ChangeOptions(const Options& options); 48 | 49 | // Add key,value to the table being constructed. 50 | // REQUIRES: key is after any previously added key according to comparator. 51 | // REQUIRES: Finish(), Abandon() have not been called 52 | void Add(const Slice& key, const Slice& value); 53 | 54 | // Advanced operation: flush any buffered key/value pairs to file. 55 | // Can be used to ensure that two adjacent entries never live in 56 | // the same data block. Most clients should not need to use this method. 57 | // REQUIRES: Finish(), Abandon() have not been called 58 | void Flush(); 59 | 60 | // Return non-ok iff some error has been detected. 61 | Status status() const; 62 | 63 | // Finish building the table. Stops using the file passed to the 64 | // constructor after this function returns. 65 | // REQUIRES: Finish(), Abandon() have not been called 66 | Status Finish(); 67 | 68 | // Indicate that the contents of this builder should be abandoned. Stops 69 | // using the file passed to the constructor after this function returns. 70 | // If the caller is not going to call Finish(), it must call Abandon() 71 | // before destroying this builder. 72 | // REQUIRES: Finish(), Abandon() have not been called 73 | void Abandon(); 74 | 75 | // Number of calls to Add() so far. 76 | uint64_t NumEntries() const; 77 | 78 | // Size of the file generated so far. If invoked after a successful 79 | // Finish() call, returns the size of the final generated file. 80 | uint64_t FileSize() const; 81 | 82 | private: 83 | bool ok() const { return status().ok(); } 84 | void WriteBlock(BlockBuilder* block, BlockHandle* handle); 85 | void WriteRawBlock(const Slice& data, CompressionType, BlockHandle* handle); 86 | 87 | struct Rep; 88 | Rep* rep_; 89 | }; 90 | 91 | } // namespace leveldb 92 | 93 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 94 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/table_builder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // TableBuilder provides the interface used to build a Table 6 | // (an immutable and sorted map from keys to values). 7 | // 8 | // Multiple threads can invoke const methods on a TableBuilder without 9 | // external synchronization, but if any of the threads may call a 10 | // non-const method, all threads accessing the same TableBuilder must use 11 | // external synchronization. 12 | 13 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 14 | #define STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 15 | 16 | #include 17 | 18 | #include "leveldb/export.h" 19 | #include "leveldb/options.h" 20 | #include "leveldb/status.h" 21 | 22 | namespace leveldb { 23 | 24 | class BlockBuilder; 25 | class BlockHandle; 26 | class WritableFile; 27 | 28 | class LEVELDB_EXPORT TableBuilder { 29 | public: 30 | // Create a builder that will store the contents of the table it is 31 | // building in *file. Does not close the file. It is up to the 32 | // caller to close the file after calling Finish(). 33 | TableBuilder(const Options& options, WritableFile* file); 34 | 35 | TableBuilder(const TableBuilder&) = delete; 36 | TableBuilder& operator=(const TableBuilder&) = delete; 37 | 38 | // REQUIRES: Either Finish() or Abandon() has been called. 39 | ~TableBuilder(); 40 | 41 | // Change the options used by this builder. Note: only some of the 42 | // option fields can be changed after construction. If a field is 43 | // not allowed to change dynamically and its value in the structure 44 | // passed to the constructor is different from its value in the 45 | // structure passed to this method, this method will return an error 46 | // without changing any fields. 47 | Status ChangeOptions(const Options& options); 48 | 49 | // Add key,value to the table being constructed. 50 | // REQUIRES: key is after any previously added key according to comparator. 51 | // REQUIRES: Finish(), Abandon() have not been called 52 | void Add(const Slice& key, const Slice& value); 53 | 54 | // Advanced operation: flush any buffered key/value pairs to file. 55 | // Can be used to ensure that two adjacent entries never live in 56 | // the same data block. Most clients should not need to use this method. 57 | // REQUIRES: Finish(), Abandon() have not been called 58 | void Flush(); 59 | 60 | // Return non-ok iff some error has been detected. 61 | Status status() const; 62 | 63 | // Finish building the table. Stops using the file passed to the 64 | // constructor after this function returns. 65 | // REQUIRES: Finish(), Abandon() have not been called 66 | Status Finish(); 67 | 68 | // Indicate that the contents of this builder should be abandoned. Stops 69 | // using the file passed to the constructor after this function returns. 70 | // If the caller is not going to call Finish(), it must call Abandon() 71 | // before destroying this builder. 72 | // REQUIRES: Finish(), Abandon() have not been called 73 | void Abandon(); 74 | 75 | // Number of calls to Add() so far. 76 | uint64_t NumEntries() const; 77 | 78 | // Size of the file generated so far. If invoked after a successful 79 | // Finish() call, returns the size of the final generated file. 80 | uint64_t FileSize() const; 81 | 82 | private: 83 | bool ok() const { return status().ok(); } 84 | void WriteBlock(BlockBuilder* block, BlockHandle* handle); 85 | void WriteRawBlock(const Slice& data, CompressionType, BlockHandle* handle); 86 | 87 | struct Rep; 88 | Rep* rep_; 89 | }; 90 | 91 | } // namespace leveldb 92 | 93 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 94 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/table_builder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // TableBuilder provides the interface used to build a Table 6 | // (an immutable and sorted map from keys to values). 7 | // 8 | // Multiple threads can invoke const methods on a TableBuilder without 9 | // external synchronization, but if any of the threads may call a 10 | // non-const method, all threads accessing the same TableBuilder must use 11 | // external synchronization. 12 | 13 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 14 | #define STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 15 | 16 | #include 17 | 18 | #include "leveldb/export.h" 19 | #include "leveldb/options.h" 20 | #include "leveldb/status.h" 21 | 22 | namespace leveldb { 23 | 24 | class BlockBuilder; 25 | class BlockHandle; 26 | class WritableFile; 27 | 28 | class LEVELDB_EXPORT TableBuilder { 29 | public: 30 | // Create a builder that will store the contents of the table it is 31 | // building in *file. Does not close the file. It is up to the 32 | // caller to close the file after calling Finish(). 33 | TableBuilder(const Options& options, WritableFile* file); 34 | 35 | TableBuilder(const TableBuilder&) = delete; 36 | TableBuilder& operator=(const TableBuilder&) = delete; 37 | 38 | // REQUIRES: Either Finish() or Abandon() has been called. 39 | ~TableBuilder(); 40 | 41 | // Change the options used by this builder. Note: only some of the 42 | // option fields can be changed after construction. If a field is 43 | // not allowed to change dynamically and its value in the structure 44 | // passed to the constructor is different from its value in the 45 | // structure passed to this method, this method will return an error 46 | // without changing any fields. 47 | Status ChangeOptions(const Options& options); 48 | 49 | // Add key,value to the table being constructed. 50 | // REQUIRES: key is after any previously added key according to comparator. 51 | // REQUIRES: Finish(), Abandon() have not been called 52 | void Add(const Slice& key, const Slice& value); 53 | 54 | // Advanced operation: flush any buffered key/value pairs to file. 55 | // Can be used to ensure that two adjacent entries never live in 56 | // the same data block. Most clients should not need to use this method. 57 | // REQUIRES: Finish(), Abandon() have not been called 58 | void Flush(); 59 | 60 | // Return non-ok iff some error has been detected. 61 | Status status() const; 62 | 63 | // Finish building the table. Stops using the file passed to the 64 | // constructor after this function returns. 65 | // REQUIRES: Finish(), Abandon() have not been called 66 | Status Finish(); 67 | 68 | // Indicate that the contents of this builder should be abandoned. Stops 69 | // using the file passed to the constructor after this function returns. 70 | // If the caller is not going to call Finish(), it must call Abandon() 71 | // before destroying this builder. 72 | // REQUIRES: Finish(), Abandon() have not been called 73 | void Abandon(); 74 | 75 | // Number of calls to Add() so far. 76 | uint64_t NumEntries() const; 77 | 78 | // Size of the file generated so far. If invoked after a successful 79 | // Finish() call, returns the size of the final generated file. 80 | uint64_t FileSize() const; 81 | 82 | private: 83 | bool ok() const { return status().ok(); } 84 | void WriteBlock(BlockBuilder* block, BlockHandle* handle); 85 | void WriteRawBlock(const Slice& data, CompressionType, BlockHandle* handle); 86 | 87 | struct Rep; 88 | Rep* rep_; 89 | }; 90 | 91 | } // namespace leveldb 92 | 93 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 94 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/table_builder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // TableBuilder provides the interface used to build a Table 6 | // (an immutable and sorted map from keys to values). 7 | // 8 | // Multiple threads can invoke const methods on a TableBuilder without 9 | // external synchronization, but if any of the threads may call a 10 | // non-const method, all threads accessing the same TableBuilder must use 11 | // external synchronization. 12 | 13 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 14 | #define STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 15 | 16 | #include 17 | 18 | #include "leveldb/export.h" 19 | #include "leveldb/options.h" 20 | #include "leveldb/status.h" 21 | 22 | namespace leveldb { 23 | 24 | class BlockBuilder; 25 | class BlockHandle; 26 | class WritableFile; 27 | 28 | class LEVELDB_EXPORT TableBuilder { 29 | public: 30 | // Create a builder that will store the contents of the table it is 31 | // building in *file. Does not close the file. It is up to the 32 | // caller to close the file after calling Finish(). 33 | TableBuilder(const Options& options, WritableFile* file); 34 | 35 | TableBuilder(const TableBuilder&) = delete; 36 | TableBuilder& operator=(const TableBuilder&) = delete; 37 | 38 | // REQUIRES: Either Finish() or Abandon() has been called. 39 | ~TableBuilder(); 40 | 41 | // Change the options used by this builder. Note: only some of the 42 | // option fields can be changed after construction. If a field is 43 | // not allowed to change dynamically and its value in the structure 44 | // passed to the constructor is different from its value in the 45 | // structure passed to this method, this method will return an error 46 | // without changing any fields. 47 | Status ChangeOptions(const Options& options); 48 | 49 | // Add key,value to the table being constructed. 50 | // REQUIRES: key is after any previously added key according to comparator. 51 | // REQUIRES: Finish(), Abandon() have not been called 52 | void Add(const Slice& key, const Slice& value); 53 | 54 | // Advanced operation: flush any buffered key/value pairs to file. 55 | // Can be used to ensure that two adjacent entries never live in 56 | // the same data block. Most clients should not need to use this method. 57 | // REQUIRES: Finish(), Abandon() have not been called 58 | void Flush(); 59 | 60 | // Return non-ok iff some error has been detected. 61 | Status status() const; 62 | 63 | // Finish building the table. Stops using the file passed to the 64 | // constructor after this function returns. 65 | // REQUIRES: Finish(), Abandon() have not been called 66 | Status Finish(); 67 | 68 | // Indicate that the contents of this builder should be abandoned. Stops 69 | // using the file passed to the constructor after this function returns. 70 | // If the caller is not going to call Finish(), it must call Abandon() 71 | // before destroying this builder. 72 | // REQUIRES: Finish(), Abandon() have not been called 73 | void Abandon(); 74 | 75 | // Number of calls to Add() so far. 76 | uint64_t NumEntries() const; 77 | 78 | // Size of the file generated so far. If invoked after a successful 79 | // Finish() call, returns the size of the final generated file. 80 | uint64_t FileSize() const; 81 | 82 | private: 83 | bool ok() const { return status().ok(); } 84 | void WriteBlock(BlockBuilder* block, BlockHandle* handle); 85 | void WriteRawBlock(const Slice& data, CompressionType, BlockHandle* handle); 86 | 87 | struct Rep; 88 | Rep* rep_; 89 | }; 90 | 91 | } // namespace leveldb 92 | 93 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 94 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/table_builder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // TableBuilder provides the interface used to build a Table 6 | // (an immutable and sorted map from keys to values). 7 | // 8 | // Multiple threads can invoke const methods on a TableBuilder without 9 | // external synchronization, but if any of the threads may call a 10 | // non-const method, all threads accessing the same TableBuilder must use 11 | // external synchronization. 12 | 13 | #ifndef STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 14 | #define STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 15 | 16 | #include 17 | 18 | #include "leveldb/export.h" 19 | #include "leveldb/options.h" 20 | #include "leveldb/status.h" 21 | 22 | namespace leveldb { 23 | 24 | class BlockBuilder; 25 | class BlockHandle; 26 | class WritableFile; 27 | 28 | class LEVELDB_EXPORT TableBuilder { 29 | public: 30 | // Create a builder that will store the contents of the table it is 31 | // building in *file. Does not close the file. It is up to the 32 | // caller to close the file after calling Finish(). 33 | TableBuilder(const Options& options, WritableFile* file); 34 | 35 | TableBuilder(const TableBuilder&) = delete; 36 | TableBuilder& operator=(const TableBuilder&) = delete; 37 | 38 | // REQUIRES: Either Finish() or Abandon() has been called. 39 | ~TableBuilder(); 40 | 41 | // Change the options used by this builder. Note: only some of the 42 | // option fields can be changed after construction. If a field is 43 | // not allowed to change dynamically and its value in the structure 44 | // passed to the constructor is different from its value in the 45 | // structure passed to this method, this method will return an error 46 | // without changing any fields. 47 | Status ChangeOptions(const Options& options); 48 | 49 | // Add key,value to the table being constructed. 50 | // REQUIRES: key is after any previously added key according to comparator. 51 | // REQUIRES: Finish(), Abandon() have not been called 52 | void Add(const Slice& key, const Slice& value); 53 | 54 | // Advanced operation: flush any buffered key/value pairs to file. 55 | // Can be used to ensure that two adjacent entries never live in 56 | // the same data block. Most clients should not need to use this method. 57 | // REQUIRES: Finish(), Abandon() have not been called 58 | void Flush(); 59 | 60 | // Return non-ok iff some error has been detected. 61 | Status status() const; 62 | 63 | // Finish building the table. Stops using the file passed to the 64 | // constructor after this function returns. 65 | // REQUIRES: Finish(), Abandon() have not been called 66 | Status Finish(); 67 | 68 | // Indicate that the contents of this builder should be abandoned. Stops 69 | // using the file passed to the constructor after this function returns. 70 | // If the caller is not going to call Finish(), it must call Abandon() 71 | // before destroying this builder. 72 | // REQUIRES: Finish(), Abandon() have not been called 73 | void Abandon(); 74 | 75 | // Number of calls to Add() so far. 76 | uint64_t NumEntries() const; 77 | 78 | // Size of the file generated so far. If invoked after a successful 79 | // Finish() call, returns the size of the final generated file. 80 | uint64_t FileSize() const; 81 | 82 | private: 83 | bool ok() const { return status().ok(); } 84 | void WriteBlock(BlockBuilder* block, BlockHandle* handle); 85 | void WriteRawBlock(const Slice& data, CompressionType, BlockHandle* handle); 86 | 87 | struct Rep; 88 | Rep* rep_; 89 | }; 90 | 91 | } // namespace leveldb 92 | 93 | #endif // STORAGE_LEVELDB_INCLUDE_TABLE_BUILDER_H_ 94 | -------------------------------------------------------------------------------- /Example/SwiftStoreExample/SwiftStoreExample/SimpleKeyValueViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SwiftStoreExample 4 | // 5 | // Created by Hemanta Sapkota on 12/05/2015. 6 | // Copyright (c) 2015 Hemanta Sapkota. All rights reserved. 7 | // 8 | import UIKit 9 | 10 | class SimpleKeyValueViewController: UIViewController { 11 | 12 | private var scrollView = UIScrollView() 13 | private var contentView = SimpleKeyValueView() 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | title = "Swift Store Demo" 19 | 20 | setupViews() 21 | } 22 | 23 | private func setupViews() { 24 | view.backgroundColor = .white 25 | 26 | // Add scrollView to the main view 27 | scrollView.translatesAutoresizingMaskIntoConstraints = false 28 | view.addSubview(scrollView) 29 | 30 | // Setup scrollView constraints 31 | NSLayoutConstraint.activate([ 32 | scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), 33 | scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor), 34 | scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor), 35 | scrollView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor) 36 | ]) 37 | 38 | // Add contentView to scrollView 39 | contentView.translatesAutoresizingMaskIntoConstraints = false 40 | scrollView.addSubview(contentView) 41 | 42 | // Setup contentView constraints 43 | NSLayoutConstraint.activate([ 44 | contentView.topAnchor.constraint(equalTo: scrollView.topAnchor), 45 | contentView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor), 46 | contentView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor), 47 | contentView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor), 48 | contentView.widthAnchor.constraint(equalTo: scrollView.widthAnchor) 49 | ]) 50 | } 51 | 52 | override func didReceiveMemoryWarning() { 53 | super.didReceiveMemoryWarning() 54 | } 55 | } 56 | 57 | class SimpleKeyValueView : UIView { 58 | 59 | init() { 60 | super.init(frame: .zero) 61 | 62 | backgroundColor = UIColor.white 63 | 64 | var keys = ["Name", "Address", "Phone", "Email"] 65 | 66 | var lastRow: SimpleRowView? = nil 67 | var index = 1 68 | 69 | for key in keys { 70 | let row = SimpleRowView(rowNumber: index, key: key) 71 | 72 | if let value = DB.store[key], !value.isEmpty { 73 | row.valueText.text = value 74 | } 75 | 76 | row.onSave = { (key, value) in 77 | DB.store[key] = value 78 | } 79 | 80 | row.onDelete = { key in 81 | DB.store.delete(key: key) 82 | } 83 | 84 | addSubview(row) 85 | row.snp.makeConstraints { (make) -> Void in 86 | if lastRow == nil { 87 | make.top.equalTo(10) 88 | } else { 89 | make.top.greaterThanOrEqualTo(lastRow!.snp.bottom).offset(5) 90 | } 91 | 92 | make.left.equalTo(0) 93 | make.width.equalTo(self.snp.width) 94 | make.height.equalTo(110) 95 | 96 | if index == keys.count { 97 | make.bottom.equalTo(self.snp.bottom).offset(-10) 98 | } 99 | 100 | lastRow = row 101 | index = index + 1 102 | } 103 | } 104 | } 105 | 106 | required init?(coder aDecoder: NSCoder) { 107 | fatalError("init(coder:) has not been implemented") 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/slice.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Slice is a simple structure containing a pointer into some external 6 | // storage and a size. The user of a Slice must ensure that the slice 7 | // is not used after the corresponding external storage has been 8 | // deallocated. 9 | // 10 | // Multiple threads can invoke const methods on a Slice without 11 | // external synchronization, but if any of the threads may call a 12 | // non-const method, all threads accessing the same Slice must use 13 | // external synchronization. 14 | 15 | #ifndef STORAGE_LEVELDB_INCLUDE_SLICE_H_ 16 | #define STORAGE_LEVELDB_INCLUDE_SLICE_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | 25 | namespace leveldb { 26 | 27 | class LEVELDB_EXPORT Slice { 28 | public: 29 | // Create an empty slice. 30 | Slice() : data_(""), size_(0) {} 31 | 32 | // Create a slice that refers to d[0,n-1]. 33 | Slice(const char* d, size_t n) : data_(d), size_(n) {} 34 | 35 | // Create a slice that refers to the contents of "s" 36 | Slice(const std::string& s) : data_(s.data()), size_(s.size()) {} 37 | 38 | // Create a slice that refers to s[0,strlen(s)-1] 39 | Slice(const char* s) : data_(s), size_(strlen(s)) {} 40 | 41 | // Intentionally copyable. 42 | Slice(const Slice&) = default; 43 | Slice& operator=(const Slice&) = default; 44 | 45 | // Return a pointer to the beginning of the referenced data 46 | const char* data() const { return data_; } 47 | 48 | // Return the length (in bytes) of the referenced data 49 | size_t size() const { return size_; } 50 | 51 | // Return true iff the length of the referenced data is zero 52 | bool empty() const { return size_ == 0; } 53 | 54 | const char* begin() const { return data(); } 55 | const char* end() const { return data() + size(); } 56 | 57 | // Return the ith byte in the referenced data. 58 | // REQUIRES: n < size() 59 | char operator[](size_t n) const { 60 | assert(n < size()); 61 | return data_[n]; 62 | } 63 | 64 | // Change this slice to refer to an empty array 65 | void clear() { 66 | data_ = ""; 67 | size_ = 0; 68 | } 69 | 70 | // Drop the first "n" bytes from this slice. 71 | void remove_prefix(size_t n) { 72 | assert(n <= size()); 73 | data_ += n; 74 | size_ -= n; 75 | } 76 | 77 | // Return a string that contains the copy of the referenced data. 78 | std::string ToString() const { return std::string(data_, size_); } 79 | 80 | // Three-way comparison. Returns value: 81 | // < 0 iff "*this" < "b", 82 | // == 0 iff "*this" == "b", 83 | // > 0 iff "*this" > "b" 84 | int compare(const Slice& b) const; 85 | 86 | // Return true iff "x" is a prefix of "*this" 87 | bool starts_with(const Slice& x) const { 88 | return ((size_ >= x.size_) && (memcmp(data_, x.data_, x.size_) == 0)); 89 | } 90 | 91 | private: 92 | const char* data_; 93 | size_t size_; 94 | }; 95 | 96 | inline bool operator==(const Slice& x, const Slice& y) { 97 | return ((x.size() == y.size()) && 98 | (memcmp(x.data(), y.data(), x.size()) == 0)); 99 | } 100 | 101 | inline bool operator!=(const Slice& x, const Slice& y) { return !(x == y); } 102 | 103 | inline int Slice::compare(const Slice& b) const { 104 | const size_t min_len = (size_ < b.size_) ? size_ : b.size_; 105 | int r = memcmp(data_, b.data_, min_len); 106 | if (r == 0) { 107 | if (size_ < b.size_) 108 | r = -1; 109 | else if (size_ > b.size_) 110 | r = +1; 111 | } 112 | return r; 113 | } 114 | 115 | } // namespace leveldb 116 | 117 | #endif // STORAGE_LEVELDB_INCLUDE_SLICE_H_ 118 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/slice.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Slice is a simple structure containing a pointer into some external 6 | // storage and a size. The user of a Slice must ensure that the slice 7 | // is not used after the corresponding external storage has been 8 | // deallocated. 9 | // 10 | // Multiple threads can invoke const methods on a Slice without 11 | // external synchronization, but if any of the threads may call a 12 | // non-const method, all threads accessing the same Slice must use 13 | // external synchronization. 14 | 15 | #ifndef STORAGE_LEVELDB_INCLUDE_SLICE_H_ 16 | #define STORAGE_LEVELDB_INCLUDE_SLICE_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | 25 | namespace leveldb { 26 | 27 | class LEVELDB_EXPORT Slice { 28 | public: 29 | // Create an empty slice. 30 | Slice() : data_(""), size_(0) {} 31 | 32 | // Create a slice that refers to d[0,n-1]. 33 | Slice(const char* d, size_t n) : data_(d), size_(n) {} 34 | 35 | // Create a slice that refers to the contents of "s" 36 | Slice(const std::string& s) : data_(s.data()), size_(s.size()) {} 37 | 38 | // Create a slice that refers to s[0,strlen(s)-1] 39 | Slice(const char* s) : data_(s), size_(strlen(s)) {} 40 | 41 | // Intentionally copyable. 42 | Slice(const Slice&) = default; 43 | Slice& operator=(const Slice&) = default; 44 | 45 | // Return a pointer to the beginning of the referenced data 46 | const char* data() const { return data_; } 47 | 48 | // Return the length (in bytes) of the referenced data 49 | size_t size() const { return size_; } 50 | 51 | // Return true iff the length of the referenced data is zero 52 | bool empty() const { return size_ == 0; } 53 | 54 | const char* begin() const { return data(); } 55 | const char* end() const { return data() + size(); } 56 | 57 | // Return the ith byte in the referenced data. 58 | // REQUIRES: n < size() 59 | char operator[](size_t n) const { 60 | assert(n < size()); 61 | return data_[n]; 62 | } 63 | 64 | // Change this slice to refer to an empty array 65 | void clear() { 66 | data_ = ""; 67 | size_ = 0; 68 | } 69 | 70 | // Drop the first "n" bytes from this slice. 71 | void remove_prefix(size_t n) { 72 | assert(n <= size()); 73 | data_ += n; 74 | size_ -= n; 75 | } 76 | 77 | // Return a string that contains the copy of the referenced data. 78 | std::string ToString() const { return std::string(data_, size_); } 79 | 80 | // Three-way comparison. Returns value: 81 | // < 0 iff "*this" < "b", 82 | // == 0 iff "*this" == "b", 83 | // > 0 iff "*this" > "b" 84 | int compare(const Slice& b) const; 85 | 86 | // Return true iff "x" is a prefix of "*this" 87 | bool starts_with(const Slice& x) const { 88 | return ((size_ >= x.size_) && (memcmp(data_, x.data_, x.size_) == 0)); 89 | } 90 | 91 | private: 92 | const char* data_; 93 | size_t size_; 94 | }; 95 | 96 | inline bool operator==(const Slice& x, const Slice& y) { 97 | return ((x.size() == y.size()) && 98 | (memcmp(x.data(), y.data(), x.size()) == 0)); 99 | } 100 | 101 | inline bool operator!=(const Slice& x, const Slice& y) { return !(x == y); } 102 | 103 | inline int Slice::compare(const Slice& b) const { 104 | const size_t min_len = (size_ < b.size_) ? size_ : b.size_; 105 | int r = memcmp(data_, b.data_, min_len); 106 | if (r == 0) { 107 | if (size_ < b.size_) 108 | r = -1; 109 | else if (size_ > b.size_) 110 | r = +1; 111 | } 112 | return r; 113 | } 114 | 115 | } // namespace leveldb 116 | 117 | #endif // STORAGE_LEVELDB_INCLUDE_SLICE_H_ 118 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/slice.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Slice is a simple structure containing a pointer into some external 6 | // storage and a size. The user of a Slice must ensure that the slice 7 | // is not used after the corresponding external storage has been 8 | // deallocated. 9 | // 10 | // Multiple threads can invoke const methods on a Slice without 11 | // external synchronization, but if any of the threads may call a 12 | // non-const method, all threads accessing the same Slice must use 13 | // external synchronization. 14 | 15 | #ifndef STORAGE_LEVELDB_INCLUDE_SLICE_H_ 16 | #define STORAGE_LEVELDB_INCLUDE_SLICE_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | 25 | namespace leveldb { 26 | 27 | class LEVELDB_EXPORT Slice { 28 | public: 29 | // Create an empty slice. 30 | Slice() : data_(""), size_(0) {} 31 | 32 | // Create a slice that refers to d[0,n-1]. 33 | Slice(const char* d, size_t n) : data_(d), size_(n) {} 34 | 35 | // Create a slice that refers to the contents of "s" 36 | Slice(const std::string& s) : data_(s.data()), size_(s.size()) {} 37 | 38 | // Create a slice that refers to s[0,strlen(s)-1] 39 | Slice(const char* s) : data_(s), size_(strlen(s)) {} 40 | 41 | // Intentionally copyable. 42 | Slice(const Slice&) = default; 43 | Slice& operator=(const Slice&) = default; 44 | 45 | // Return a pointer to the beginning of the referenced data 46 | const char* data() const { return data_; } 47 | 48 | // Return the length (in bytes) of the referenced data 49 | size_t size() const { return size_; } 50 | 51 | // Return true iff the length of the referenced data is zero 52 | bool empty() const { return size_ == 0; } 53 | 54 | const char* begin() const { return data(); } 55 | const char* end() const { return data() + size(); } 56 | 57 | // Return the ith byte in the referenced data. 58 | // REQUIRES: n < size() 59 | char operator[](size_t n) const { 60 | assert(n < size()); 61 | return data_[n]; 62 | } 63 | 64 | // Change this slice to refer to an empty array 65 | void clear() { 66 | data_ = ""; 67 | size_ = 0; 68 | } 69 | 70 | // Drop the first "n" bytes from this slice. 71 | void remove_prefix(size_t n) { 72 | assert(n <= size()); 73 | data_ += n; 74 | size_ -= n; 75 | } 76 | 77 | // Return a string that contains the copy of the referenced data. 78 | std::string ToString() const { return std::string(data_, size_); } 79 | 80 | // Three-way comparison. Returns value: 81 | // < 0 iff "*this" < "b", 82 | // == 0 iff "*this" == "b", 83 | // > 0 iff "*this" > "b" 84 | int compare(const Slice& b) const; 85 | 86 | // Return true iff "x" is a prefix of "*this" 87 | bool starts_with(const Slice& x) const { 88 | return ((size_ >= x.size_) && (memcmp(data_, x.data_, x.size_) == 0)); 89 | } 90 | 91 | private: 92 | const char* data_; 93 | size_t size_; 94 | }; 95 | 96 | inline bool operator==(const Slice& x, const Slice& y) { 97 | return ((x.size() == y.size()) && 98 | (memcmp(x.data(), y.data(), x.size()) == 0)); 99 | } 100 | 101 | inline bool operator!=(const Slice& x, const Slice& y) { return !(x == y); } 102 | 103 | inline int Slice::compare(const Slice& b) const { 104 | const size_t min_len = (size_ < b.size_) ? size_ : b.size_; 105 | int r = memcmp(data_, b.data_, min_len); 106 | if (r == 0) { 107 | if (size_ < b.size_) 108 | r = -1; 109 | else if (size_ > b.size_) 110 | r = +1; 111 | } 112 | return r; 113 | } 114 | 115 | } // namespace leveldb 116 | 117 | #endif // STORAGE_LEVELDB_INCLUDE_SLICE_H_ 118 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/slice.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Slice is a simple structure containing a pointer into some external 6 | // storage and a size. The user of a Slice must ensure that the slice 7 | // is not used after the corresponding external storage has been 8 | // deallocated. 9 | // 10 | // Multiple threads can invoke const methods on a Slice without 11 | // external synchronization, but if any of the threads may call a 12 | // non-const method, all threads accessing the same Slice must use 13 | // external synchronization. 14 | 15 | #ifndef STORAGE_LEVELDB_INCLUDE_SLICE_H_ 16 | #define STORAGE_LEVELDB_INCLUDE_SLICE_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | 25 | namespace leveldb { 26 | 27 | class LEVELDB_EXPORT Slice { 28 | public: 29 | // Create an empty slice. 30 | Slice() : data_(""), size_(0) {} 31 | 32 | // Create a slice that refers to d[0,n-1]. 33 | Slice(const char* d, size_t n) : data_(d), size_(n) {} 34 | 35 | // Create a slice that refers to the contents of "s" 36 | Slice(const std::string& s) : data_(s.data()), size_(s.size()) {} 37 | 38 | // Create a slice that refers to s[0,strlen(s)-1] 39 | Slice(const char* s) : data_(s), size_(strlen(s)) {} 40 | 41 | // Intentionally copyable. 42 | Slice(const Slice&) = default; 43 | Slice& operator=(const Slice&) = default; 44 | 45 | // Return a pointer to the beginning of the referenced data 46 | const char* data() const { return data_; } 47 | 48 | // Return the length (in bytes) of the referenced data 49 | size_t size() const { return size_; } 50 | 51 | // Return true iff the length of the referenced data is zero 52 | bool empty() const { return size_ == 0; } 53 | 54 | const char* begin() const { return data(); } 55 | const char* end() const { return data() + size(); } 56 | 57 | // Return the ith byte in the referenced data. 58 | // REQUIRES: n < size() 59 | char operator[](size_t n) const { 60 | assert(n < size()); 61 | return data_[n]; 62 | } 63 | 64 | // Change this slice to refer to an empty array 65 | void clear() { 66 | data_ = ""; 67 | size_ = 0; 68 | } 69 | 70 | // Drop the first "n" bytes from this slice. 71 | void remove_prefix(size_t n) { 72 | assert(n <= size()); 73 | data_ += n; 74 | size_ -= n; 75 | } 76 | 77 | // Return a string that contains the copy of the referenced data. 78 | std::string ToString() const { return std::string(data_, size_); } 79 | 80 | // Three-way comparison. Returns value: 81 | // < 0 iff "*this" < "b", 82 | // == 0 iff "*this" == "b", 83 | // > 0 iff "*this" > "b" 84 | int compare(const Slice& b) const; 85 | 86 | // Return true iff "x" is a prefix of "*this" 87 | bool starts_with(const Slice& x) const { 88 | return ((size_ >= x.size_) && (memcmp(data_, x.data_, x.size_) == 0)); 89 | } 90 | 91 | private: 92 | const char* data_; 93 | size_t size_; 94 | }; 95 | 96 | inline bool operator==(const Slice& x, const Slice& y) { 97 | return ((x.size() == y.size()) && 98 | (memcmp(x.data(), y.data(), x.size()) == 0)); 99 | } 100 | 101 | inline bool operator!=(const Slice& x, const Slice& y) { return !(x == y); } 102 | 103 | inline int Slice::compare(const Slice& b) const { 104 | const size_t min_len = (size_ < b.size_) ? size_ : b.size_; 105 | int r = memcmp(data_, b.data_, min_len); 106 | if (r == 0) { 107 | if (size_ < b.size_) 108 | r = -1; 109 | else if (size_ > b.size_) 110 | r = +1; 111 | } 112 | return r; 113 | } 114 | 115 | } // namespace leveldb 116 | 117 | #endif // STORAGE_LEVELDB_INCLUDE_SLICE_H_ 118 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/slice.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Slice is a simple structure containing a pointer into some external 6 | // storage and a size. The user of a Slice must ensure that the slice 7 | // is not used after the corresponding external storage has been 8 | // deallocated. 9 | // 10 | // Multiple threads can invoke const methods on a Slice without 11 | // external synchronization, but if any of the threads may call a 12 | // non-const method, all threads accessing the same Slice must use 13 | // external synchronization. 14 | 15 | #ifndef STORAGE_LEVELDB_INCLUDE_SLICE_H_ 16 | #define STORAGE_LEVELDB_INCLUDE_SLICE_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | 25 | namespace leveldb { 26 | 27 | class LEVELDB_EXPORT Slice { 28 | public: 29 | // Create an empty slice. 30 | Slice() : data_(""), size_(0) {} 31 | 32 | // Create a slice that refers to d[0,n-1]. 33 | Slice(const char* d, size_t n) : data_(d), size_(n) {} 34 | 35 | // Create a slice that refers to the contents of "s" 36 | Slice(const std::string& s) : data_(s.data()), size_(s.size()) {} 37 | 38 | // Create a slice that refers to s[0,strlen(s)-1] 39 | Slice(const char* s) : data_(s), size_(strlen(s)) {} 40 | 41 | // Intentionally copyable. 42 | Slice(const Slice&) = default; 43 | Slice& operator=(const Slice&) = default; 44 | 45 | // Return a pointer to the beginning of the referenced data 46 | const char* data() const { return data_; } 47 | 48 | // Return the length (in bytes) of the referenced data 49 | size_t size() const { return size_; } 50 | 51 | // Return true iff the length of the referenced data is zero 52 | bool empty() const { return size_ == 0; } 53 | 54 | const char* begin() const { return data(); } 55 | const char* end() const { return data() + size(); } 56 | 57 | // Return the ith byte in the referenced data. 58 | // REQUIRES: n < size() 59 | char operator[](size_t n) const { 60 | assert(n < size()); 61 | return data_[n]; 62 | } 63 | 64 | // Change this slice to refer to an empty array 65 | void clear() { 66 | data_ = ""; 67 | size_ = 0; 68 | } 69 | 70 | // Drop the first "n" bytes from this slice. 71 | void remove_prefix(size_t n) { 72 | assert(n <= size()); 73 | data_ += n; 74 | size_ -= n; 75 | } 76 | 77 | // Return a string that contains the copy of the referenced data. 78 | std::string ToString() const { return std::string(data_, size_); } 79 | 80 | // Three-way comparison. Returns value: 81 | // < 0 iff "*this" < "b", 82 | // == 0 iff "*this" == "b", 83 | // > 0 iff "*this" > "b" 84 | int compare(const Slice& b) const; 85 | 86 | // Return true iff "x" is a prefix of "*this" 87 | bool starts_with(const Slice& x) const { 88 | return ((size_ >= x.size_) && (memcmp(data_, x.data_, x.size_) == 0)); 89 | } 90 | 91 | private: 92 | const char* data_; 93 | size_t size_; 94 | }; 95 | 96 | inline bool operator==(const Slice& x, const Slice& y) { 97 | return ((x.size() == y.size()) && 98 | (memcmp(x.data(), y.data(), x.size()) == 0)); 99 | } 100 | 101 | inline bool operator!=(const Slice& x, const Slice& y) { return !(x == y); } 102 | 103 | inline int Slice::compare(const Slice& b) const { 104 | const size_t min_len = (size_ < b.size_) ? size_ : b.size_; 105 | int r = memcmp(data_, b.data_, min_len); 106 | if (r == 0) { 107 | if (size_ < b.size_) 108 | r = -1; 109 | else if (size_ > b.size_) 110 | r = +1; 111 | } 112 | return r; 113 | } 114 | 115 | } // namespace leveldb 116 | 117 | #endif // STORAGE_LEVELDB_INCLUDE_SLICE_H_ 118 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/slice.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // Slice is a simple structure containing a pointer into some external 6 | // storage and a size. The user of a Slice must ensure that the slice 7 | // is not used after the corresponding external storage has been 8 | // deallocated. 9 | // 10 | // Multiple threads can invoke const methods on a Slice without 11 | // external synchronization, but if any of the threads may call a 12 | // non-const method, all threads accessing the same Slice must use 13 | // external synchronization. 14 | 15 | #ifndef STORAGE_LEVELDB_INCLUDE_SLICE_H_ 16 | #define STORAGE_LEVELDB_INCLUDE_SLICE_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | 25 | namespace leveldb { 26 | 27 | class LEVELDB_EXPORT Slice { 28 | public: 29 | // Create an empty slice. 30 | Slice() : data_(""), size_(0) {} 31 | 32 | // Create a slice that refers to d[0,n-1]. 33 | Slice(const char* d, size_t n) : data_(d), size_(n) {} 34 | 35 | // Create a slice that refers to the contents of "s" 36 | Slice(const std::string& s) : data_(s.data()), size_(s.size()) {} 37 | 38 | // Create a slice that refers to s[0,strlen(s)-1] 39 | Slice(const char* s) : data_(s), size_(strlen(s)) {} 40 | 41 | // Intentionally copyable. 42 | Slice(const Slice&) = default; 43 | Slice& operator=(const Slice&) = default; 44 | 45 | // Return a pointer to the beginning of the referenced data 46 | const char* data() const { return data_; } 47 | 48 | // Return the length (in bytes) of the referenced data 49 | size_t size() const { return size_; } 50 | 51 | // Return true iff the length of the referenced data is zero 52 | bool empty() const { return size_ == 0; } 53 | 54 | const char* begin() const { return data(); } 55 | const char* end() const { return data() + size(); } 56 | 57 | // Return the ith byte in the referenced data. 58 | // REQUIRES: n < size() 59 | char operator[](size_t n) const { 60 | assert(n < size()); 61 | return data_[n]; 62 | } 63 | 64 | // Change this slice to refer to an empty array 65 | void clear() { 66 | data_ = ""; 67 | size_ = 0; 68 | } 69 | 70 | // Drop the first "n" bytes from this slice. 71 | void remove_prefix(size_t n) { 72 | assert(n <= size()); 73 | data_ += n; 74 | size_ -= n; 75 | } 76 | 77 | // Return a string that contains the copy of the referenced data. 78 | std::string ToString() const { return std::string(data_, size_); } 79 | 80 | // Three-way comparison. Returns value: 81 | // < 0 iff "*this" < "b", 82 | // == 0 iff "*this" == "b", 83 | // > 0 iff "*this" > "b" 84 | int compare(const Slice& b) const; 85 | 86 | // Return true iff "x" is a prefix of "*this" 87 | bool starts_with(const Slice& x) const { 88 | return ((size_ >= x.size_) && (memcmp(data_, x.data_, x.size_) == 0)); 89 | } 90 | 91 | private: 92 | const char* data_; 93 | size_t size_; 94 | }; 95 | 96 | inline bool operator==(const Slice& x, const Slice& y) { 97 | return ((x.size() == y.size()) && 98 | (memcmp(x.data(), y.data(), x.size()) == 0)); 99 | } 100 | 101 | inline bool operator!=(const Slice& x, const Slice& y) { return !(x == y); } 102 | 103 | inline int Slice::compare(const Slice& b) const { 104 | const size_t min_len = (size_ < b.size_) ? size_ : b.size_; 105 | int r = memcmp(data_, b.data_, min_len); 106 | if (r == 0) { 107 | if (size_ < b.size_) 108 | r = -1; 109 | else if (size_ > b.size_) 110 | r = +1; 111 | } 112 | return r; 113 | } 114 | 115 | } // namespace leveldb 116 | 117 | #endif // STORAGE_LEVELDB_INCLUDE_SLICE_H_ 118 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/cache.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A Cache is an interface that maps keys to values. It has internal 6 | // synchronization and may be safely accessed concurrently from 7 | // multiple threads. It may automatically evict entries to make room 8 | // for new entries. Values have a specified charge against the cache 9 | // capacity. For example, a cache where the values are variable 10 | // length strings, may use the length of the string as the charge for 11 | // the string. 12 | // 13 | // A builtin cache implementation with a least-recently-used eviction 14 | // policy is provided. Clients may use their own implementations if 15 | // they want something more sophisticated (like scan-resistance, a 16 | // custom eviction policy, variable cache sizing, etc.) 17 | 18 | #ifndef STORAGE_LEVELDB_INCLUDE_CACHE_H_ 19 | #define STORAGE_LEVELDB_INCLUDE_CACHE_H_ 20 | 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | #include "leveldb/slice.h" 25 | 26 | namespace leveldb { 27 | 28 | class LEVELDB_EXPORT Cache; 29 | 30 | // Create a new cache with a fixed size capacity. This implementation 31 | // of Cache uses a least-recently-used eviction policy. 32 | LEVELDB_EXPORT Cache* NewLRUCache(size_t capacity); 33 | 34 | class LEVELDB_EXPORT Cache { 35 | public: 36 | Cache() = default; 37 | 38 | Cache(const Cache&) = delete; 39 | Cache& operator=(const Cache&) = delete; 40 | 41 | // Destroys all existing entries by calling the "deleter" 42 | // function that was passed to the constructor. 43 | virtual ~Cache(); 44 | 45 | // Opaque handle to an entry stored in the cache. 46 | struct Handle {}; 47 | 48 | // Insert a mapping from key->value into the cache and assign it 49 | // the specified charge against the total cache capacity. 50 | // 51 | // Returns a handle that corresponds to the mapping. The caller 52 | // must call this->Release(handle) when the returned mapping is no 53 | // longer needed. 54 | // 55 | // When the inserted entry is no longer needed, the key and 56 | // value will be passed to "deleter". 57 | virtual Handle* Insert(const Slice& key, void* value, size_t charge, 58 | void (*deleter)(const Slice& key, void* value)) = 0; 59 | 60 | // If the cache has no mapping for "key", returns nullptr. 61 | // 62 | // Else return a handle that corresponds to the mapping. The caller 63 | // must call this->Release(handle) when the returned mapping is no 64 | // longer needed. 65 | virtual Handle* Lookup(const Slice& key) = 0; 66 | 67 | // Release a mapping returned by a previous Lookup(). 68 | // REQUIRES: handle must not have been released yet. 69 | // REQUIRES: handle must have been returned by a method on *this. 70 | virtual void Release(Handle* handle) = 0; 71 | 72 | // Return the value encapsulated in a handle returned by a 73 | // successful Lookup(). 74 | // REQUIRES: handle must not have been released yet. 75 | // REQUIRES: handle must have been returned by a method on *this. 76 | virtual void* Value(Handle* handle) = 0; 77 | 78 | // If the cache contains entry for key, erase it. Note that the 79 | // underlying entry will be kept around until all existing handles 80 | // to it have been released. 81 | virtual void Erase(const Slice& key) = 0; 82 | 83 | // Return a new numeric id. May be used by multiple clients who are 84 | // sharing the same cache to partition the key space. Typically the 85 | // client will allocate a new id at startup and prepend the id to 86 | // its cache keys. 87 | virtual uint64_t NewId() = 0; 88 | 89 | // Remove all cache entries that are not actively in use. Memory-constrained 90 | // applications may wish to call this method to reduce memory usage. 91 | // Default implementation of Prune() does nothing. Subclasses are strongly 92 | // encouraged to override the default implementation. A future release of 93 | // leveldb may change Prune() to a pure abstract method. 94 | virtual void Prune() {} 95 | 96 | // Return an estimate of the combined charges of all elements stored in the 97 | // cache. 98 | virtual size_t TotalCharge() const = 0; 99 | }; 100 | 101 | } // namespace leveldb 102 | 103 | #endif // STORAGE_LEVELDB_INCLUDE_CACHE_H_ 104 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64/LevelDB.framework/Headers/leveldb/cache.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A Cache is an interface that maps keys to values. It has internal 6 | // synchronization and may be safely accessed concurrently from 7 | // multiple threads. It may automatically evict entries to make room 8 | // for new entries. Values have a specified charge against the cache 9 | // capacity. For example, a cache where the values are variable 10 | // length strings, may use the length of the string as the charge for 11 | // the string. 12 | // 13 | // A builtin cache implementation with a least-recently-used eviction 14 | // policy is provided. Clients may use their own implementations if 15 | // they want something more sophisticated (like scan-resistance, a 16 | // custom eviction policy, variable cache sizing, etc.) 17 | 18 | #ifndef STORAGE_LEVELDB_INCLUDE_CACHE_H_ 19 | #define STORAGE_LEVELDB_INCLUDE_CACHE_H_ 20 | 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | #include "leveldb/slice.h" 25 | 26 | namespace leveldb { 27 | 28 | class LEVELDB_EXPORT Cache; 29 | 30 | // Create a new cache with a fixed size capacity. This implementation 31 | // of Cache uses a least-recently-used eviction policy. 32 | LEVELDB_EXPORT Cache* NewLRUCache(size_t capacity); 33 | 34 | class LEVELDB_EXPORT Cache { 35 | public: 36 | Cache() = default; 37 | 38 | Cache(const Cache&) = delete; 39 | Cache& operator=(const Cache&) = delete; 40 | 41 | // Destroys all existing entries by calling the "deleter" 42 | // function that was passed to the constructor. 43 | virtual ~Cache(); 44 | 45 | // Opaque handle to an entry stored in the cache. 46 | struct Handle {}; 47 | 48 | // Insert a mapping from key->value into the cache and assign it 49 | // the specified charge against the total cache capacity. 50 | // 51 | // Returns a handle that corresponds to the mapping. The caller 52 | // must call this->Release(handle) when the returned mapping is no 53 | // longer needed. 54 | // 55 | // When the inserted entry is no longer needed, the key and 56 | // value will be passed to "deleter". 57 | virtual Handle* Insert(const Slice& key, void* value, size_t charge, 58 | void (*deleter)(const Slice& key, void* value)) = 0; 59 | 60 | // If the cache has no mapping for "key", returns nullptr. 61 | // 62 | // Else return a handle that corresponds to the mapping. The caller 63 | // must call this->Release(handle) when the returned mapping is no 64 | // longer needed. 65 | virtual Handle* Lookup(const Slice& key) = 0; 66 | 67 | // Release a mapping returned by a previous Lookup(). 68 | // REQUIRES: handle must not have been released yet. 69 | // REQUIRES: handle must have been returned by a method on *this. 70 | virtual void Release(Handle* handle) = 0; 71 | 72 | // Return the value encapsulated in a handle returned by a 73 | // successful Lookup(). 74 | // REQUIRES: handle must not have been released yet. 75 | // REQUIRES: handle must have been returned by a method on *this. 76 | virtual void* Value(Handle* handle) = 0; 77 | 78 | // If the cache contains entry for key, erase it. Note that the 79 | // underlying entry will be kept around until all existing handles 80 | // to it have been released. 81 | virtual void Erase(const Slice& key) = 0; 82 | 83 | // Return a new numeric id. May be used by multiple clients who are 84 | // sharing the same cache to partition the key space. Typically the 85 | // client will allocate a new id at startup and prepend the id to 86 | // its cache keys. 87 | virtual uint64_t NewId() = 0; 88 | 89 | // Remove all cache entries that are not actively in use. Memory-constrained 90 | // applications may wish to call this method to reduce memory usage. 91 | // Default implementation of Prune() does nothing. Subclasses are strongly 92 | // encouraged to override the default implementation. A future release of 93 | // leveldb may change Prune() to a pure abstract method. 94 | virtual void Prune() {} 95 | 96 | // Return an estimate of the combined charges of all elements stored in the 97 | // cache. 98 | virtual size_t TotalCharge() const = 0; 99 | }; 100 | 101 | } // namespace leveldb 102 | 103 | #endif // STORAGE_LEVELDB_INCLUDE_CACHE_H_ 104 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/cache.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A Cache is an interface that maps keys to values. It has internal 6 | // synchronization and may be safely accessed concurrently from 7 | // multiple threads. It may automatically evict entries to make room 8 | // for new entries. Values have a specified charge against the cache 9 | // capacity. For example, a cache where the values are variable 10 | // length strings, may use the length of the string as the charge for 11 | // the string. 12 | // 13 | // A builtin cache implementation with a least-recently-used eviction 14 | // policy is provided. Clients may use their own implementations if 15 | // they want something more sophisticated (like scan-resistance, a 16 | // custom eviction policy, variable cache sizing, etc.) 17 | 18 | #ifndef STORAGE_LEVELDB_INCLUDE_CACHE_H_ 19 | #define STORAGE_LEVELDB_INCLUDE_CACHE_H_ 20 | 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | #include "leveldb/slice.h" 25 | 26 | namespace leveldb { 27 | 28 | class LEVELDB_EXPORT Cache; 29 | 30 | // Create a new cache with a fixed size capacity. This implementation 31 | // of Cache uses a least-recently-used eviction policy. 32 | LEVELDB_EXPORT Cache* NewLRUCache(size_t capacity); 33 | 34 | class LEVELDB_EXPORT Cache { 35 | public: 36 | Cache() = default; 37 | 38 | Cache(const Cache&) = delete; 39 | Cache& operator=(const Cache&) = delete; 40 | 41 | // Destroys all existing entries by calling the "deleter" 42 | // function that was passed to the constructor. 43 | virtual ~Cache(); 44 | 45 | // Opaque handle to an entry stored in the cache. 46 | struct Handle {}; 47 | 48 | // Insert a mapping from key->value into the cache and assign it 49 | // the specified charge against the total cache capacity. 50 | // 51 | // Returns a handle that corresponds to the mapping. The caller 52 | // must call this->Release(handle) when the returned mapping is no 53 | // longer needed. 54 | // 55 | // When the inserted entry is no longer needed, the key and 56 | // value will be passed to "deleter". 57 | virtual Handle* Insert(const Slice& key, void* value, size_t charge, 58 | void (*deleter)(const Slice& key, void* value)) = 0; 59 | 60 | // If the cache has no mapping for "key", returns nullptr. 61 | // 62 | // Else return a handle that corresponds to the mapping. The caller 63 | // must call this->Release(handle) when the returned mapping is no 64 | // longer needed. 65 | virtual Handle* Lookup(const Slice& key) = 0; 66 | 67 | // Release a mapping returned by a previous Lookup(). 68 | // REQUIRES: handle must not have been released yet. 69 | // REQUIRES: handle must have been returned by a method on *this. 70 | virtual void Release(Handle* handle) = 0; 71 | 72 | // Return the value encapsulated in a handle returned by a 73 | // successful Lookup(). 74 | // REQUIRES: handle must not have been released yet. 75 | // REQUIRES: handle must have been returned by a method on *this. 76 | virtual void* Value(Handle* handle) = 0; 77 | 78 | // If the cache contains entry for key, erase it. Note that the 79 | // underlying entry will be kept around until all existing handles 80 | // to it have been released. 81 | virtual void Erase(const Slice& key) = 0; 82 | 83 | // Return a new numeric id. May be used by multiple clients who are 84 | // sharing the same cache to partition the key space. Typically the 85 | // client will allocate a new id at startup and prepend the id to 86 | // its cache keys. 87 | virtual uint64_t NewId() = 0; 88 | 89 | // Remove all cache entries that are not actively in use. Memory-constrained 90 | // applications may wish to call this method to reduce memory usage. 91 | // Default implementation of Prune() does nothing. Subclasses are strongly 92 | // encouraged to override the default implementation. A future release of 93 | // leveldb may change Prune() to a pure abstract method. 94 | virtual void Prune() {} 95 | 96 | // Return an estimate of the combined charges of all elements stored in the 97 | // cache. 98 | virtual size_t TotalCharge() const = 0; 99 | }; 100 | 101 | } // namespace leveldb 102 | 103 | #endif // STORAGE_LEVELDB_INCLUDE_CACHE_H_ 104 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/cache.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A Cache is an interface that maps keys to values. It has internal 6 | // synchronization and may be safely accessed concurrently from 7 | // multiple threads. It may automatically evict entries to make room 8 | // for new entries. Values have a specified charge against the cache 9 | // capacity. For example, a cache where the values are variable 10 | // length strings, may use the length of the string as the charge for 11 | // the string. 12 | // 13 | // A builtin cache implementation with a least-recently-used eviction 14 | // policy is provided. Clients may use their own implementations if 15 | // they want something more sophisticated (like scan-resistance, a 16 | // custom eviction policy, variable cache sizing, etc.) 17 | 18 | #ifndef STORAGE_LEVELDB_INCLUDE_CACHE_H_ 19 | #define STORAGE_LEVELDB_INCLUDE_CACHE_H_ 20 | 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | #include "leveldb/slice.h" 25 | 26 | namespace leveldb { 27 | 28 | class LEVELDB_EXPORT Cache; 29 | 30 | // Create a new cache with a fixed size capacity. This implementation 31 | // of Cache uses a least-recently-used eviction policy. 32 | LEVELDB_EXPORT Cache* NewLRUCache(size_t capacity); 33 | 34 | class LEVELDB_EXPORT Cache { 35 | public: 36 | Cache() = default; 37 | 38 | Cache(const Cache&) = delete; 39 | Cache& operator=(const Cache&) = delete; 40 | 41 | // Destroys all existing entries by calling the "deleter" 42 | // function that was passed to the constructor. 43 | virtual ~Cache(); 44 | 45 | // Opaque handle to an entry stored in the cache. 46 | struct Handle {}; 47 | 48 | // Insert a mapping from key->value into the cache and assign it 49 | // the specified charge against the total cache capacity. 50 | // 51 | // Returns a handle that corresponds to the mapping. The caller 52 | // must call this->Release(handle) when the returned mapping is no 53 | // longer needed. 54 | // 55 | // When the inserted entry is no longer needed, the key and 56 | // value will be passed to "deleter". 57 | virtual Handle* Insert(const Slice& key, void* value, size_t charge, 58 | void (*deleter)(const Slice& key, void* value)) = 0; 59 | 60 | // If the cache has no mapping for "key", returns nullptr. 61 | // 62 | // Else return a handle that corresponds to the mapping. The caller 63 | // must call this->Release(handle) when the returned mapping is no 64 | // longer needed. 65 | virtual Handle* Lookup(const Slice& key) = 0; 66 | 67 | // Release a mapping returned by a previous Lookup(). 68 | // REQUIRES: handle must not have been released yet. 69 | // REQUIRES: handle must have been returned by a method on *this. 70 | virtual void Release(Handle* handle) = 0; 71 | 72 | // Return the value encapsulated in a handle returned by a 73 | // successful Lookup(). 74 | // REQUIRES: handle must not have been released yet. 75 | // REQUIRES: handle must have been returned by a method on *this. 76 | virtual void* Value(Handle* handle) = 0; 77 | 78 | // If the cache contains entry for key, erase it. Note that the 79 | // underlying entry will be kept around until all existing handles 80 | // to it have been released. 81 | virtual void Erase(const Slice& key) = 0; 82 | 83 | // Return a new numeric id. May be used by multiple clients who are 84 | // sharing the same cache to partition the key space. Typically the 85 | // client will allocate a new id at startup and prepend the id to 86 | // its cache keys. 87 | virtual uint64_t NewId() = 0; 88 | 89 | // Remove all cache entries that are not actively in use. Memory-constrained 90 | // applications may wish to call this method to reduce memory usage. 91 | // Default implementation of Prune() does nothing. Subclasses are strongly 92 | // encouraged to override the default implementation. A future release of 93 | // leveldb may change Prune() to a pure abstract method. 94 | virtual void Prune() {} 95 | 96 | // Return an estimate of the combined charges of all elements stored in the 97 | // cache. 98 | virtual size_t TotalCharge() const = 0; 99 | }; 100 | 101 | } // namespace leveldb 102 | 103 | #endif // STORAGE_LEVELDB_INCLUDE_CACHE_H_ 104 | -------------------------------------------------------------------------------- /LevelDB.xcframework/macos-arm64_x86_64/LevelDB.framework/Headers/leveldb/cache.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A Cache is an interface that maps keys to values. It has internal 6 | // synchronization and may be safely accessed concurrently from 7 | // multiple threads. It may automatically evict entries to make room 8 | // for new entries. Values have a specified charge against the cache 9 | // capacity. For example, a cache where the values are variable 10 | // length strings, may use the length of the string as the charge for 11 | // the string. 12 | // 13 | // A builtin cache implementation with a least-recently-used eviction 14 | // policy is provided. Clients may use their own implementations if 15 | // they want something more sophisticated (like scan-resistance, a 16 | // custom eviction policy, variable cache sizing, etc.) 17 | 18 | #ifndef STORAGE_LEVELDB_INCLUDE_CACHE_H_ 19 | #define STORAGE_LEVELDB_INCLUDE_CACHE_H_ 20 | 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | #include "leveldb/slice.h" 25 | 26 | namespace leveldb { 27 | 28 | class LEVELDB_EXPORT Cache; 29 | 30 | // Create a new cache with a fixed size capacity. This implementation 31 | // of Cache uses a least-recently-used eviction policy. 32 | LEVELDB_EXPORT Cache* NewLRUCache(size_t capacity); 33 | 34 | class LEVELDB_EXPORT Cache { 35 | public: 36 | Cache() = default; 37 | 38 | Cache(const Cache&) = delete; 39 | Cache& operator=(const Cache&) = delete; 40 | 41 | // Destroys all existing entries by calling the "deleter" 42 | // function that was passed to the constructor. 43 | virtual ~Cache(); 44 | 45 | // Opaque handle to an entry stored in the cache. 46 | struct Handle {}; 47 | 48 | // Insert a mapping from key->value into the cache and assign it 49 | // the specified charge against the total cache capacity. 50 | // 51 | // Returns a handle that corresponds to the mapping. The caller 52 | // must call this->Release(handle) when the returned mapping is no 53 | // longer needed. 54 | // 55 | // When the inserted entry is no longer needed, the key and 56 | // value will be passed to "deleter". 57 | virtual Handle* Insert(const Slice& key, void* value, size_t charge, 58 | void (*deleter)(const Slice& key, void* value)) = 0; 59 | 60 | // If the cache has no mapping for "key", returns nullptr. 61 | // 62 | // Else return a handle that corresponds to the mapping. The caller 63 | // must call this->Release(handle) when the returned mapping is no 64 | // longer needed. 65 | virtual Handle* Lookup(const Slice& key) = 0; 66 | 67 | // Release a mapping returned by a previous Lookup(). 68 | // REQUIRES: handle must not have been released yet. 69 | // REQUIRES: handle must have been returned by a method on *this. 70 | virtual void Release(Handle* handle) = 0; 71 | 72 | // Return the value encapsulated in a handle returned by a 73 | // successful Lookup(). 74 | // REQUIRES: handle must not have been released yet. 75 | // REQUIRES: handle must have been returned by a method on *this. 76 | virtual void* Value(Handle* handle) = 0; 77 | 78 | // If the cache contains entry for key, erase it. Note that the 79 | // underlying entry will be kept around until all existing handles 80 | // to it have been released. 81 | virtual void Erase(const Slice& key) = 0; 82 | 83 | // Return a new numeric id. May be used by multiple clients who are 84 | // sharing the same cache to partition the key space. Typically the 85 | // client will allocate a new id at startup and prepend the id to 86 | // its cache keys. 87 | virtual uint64_t NewId() = 0; 88 | 89 | // Remove all cache entries that are not actively in use. Memory-constrained 90 | // applications may wish to call this method to reduce memory usage. 91 | // Default implementation of Prune() does nothing. Subclasses are strongly 92 | // encouraged to override the default implementation. A future release of 93 | // leveldb may change Prune() to a pure abstract method. 94 | virtual void Prune() {} 95 | 96 | // Return an estimate of the combined charges of all elements stored in the 97 | // cache. 98 | virtual size_t TotalCharge() const = 0; 99 | }; 100 | 101 | } // namespace leveldb 102 | 103 | #endif // STORAGE_LEVELDB_INCLUDE_CACHE_H_ 104 | -------------------------------------------------------------------------------- /LevelDB.xcframework/ios-arm64_x86_64-simulator/LevelDB.framework/Headers/leveldb/cache.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | // 5 | // A Cache is an interface that maps keys to values. It has internal 6 | // synchronization and may be safely accessed concurrently from 7 | // multiple threads. It may automatically evict entries to make room 8 | // for new entries. Values have a specified charge against the cache 9 | // capacity. For example, a cache where the values are variable 10 | // length strings, may use the length of the string as the charge for 11 | // the string. 12 | // 13 | // A builtin cache implementation with a least-recently-used eviction 14 | // policy is provided. Clients may use their own implementations if 15 | // they want something more sophisticated (like scan-resistance, a 16 | // custom eviction policy, variable cache sizing, etc.) 17 | 18 | #ifndef STORAGE_LEVELDB_INCLUDE_CACHE_H_ 19 | #define STORAGE_LEVELDB_INCLUDE_CACHE_H_ 20 | 21 | #include 22 | 23 | #include "leveldb/export.h" 24 | #include "leveldb/slice.h" 25 | 26 | namespace leveldb { 27 | 28 | class LEVELDB_EXPORT Cache; 29 | 30 | // Create a new cache with a fixed size capacity. This implementation 31 | // of Cache uses a least-recently-used eviction policy. 32 | LEVELDB_EXPORT Cache* NewLRUCache(size_t capacity); 33 | 34 | class LEVELDB_EXPORT Cache { 35 | public: 36 | Cache() = default; 37 | 38 | Cache(const Cache&) = delete; 39 | Cache& operator=(const Cache&) = delete; 40 | 41 | // Destroys all existing entries by calling the "deleter" 42 | // function that was passed to the constructor. 43 | virtual ~Cache(); 44 | 45 | // Opaque handle to an entry stored in the cache. 46 | struct Handle {}; 47 | 48 | // Insert a mapping from key->value into the cache and assign it 49 | // the specified charge against the total cache capacity. 50 | // 51 | // Returns a handle that corresponds to the mapping. The caller 52 | // must call this->Release(handle) when the returned mapping is no 53 | // longer needed. 54 | // 55 | // When the inserted entry is no longer needed, the key and 56 | // value will be passed to "deleter". 57 | virtual Handle* Insert(const Slice& key, void* value, size_t charge, 58 | void (*deleter)(const Slice& key, void* value)) = 0; 59 | 60 | // If the cache has no mapping for "key", returns nullptr. 61 | // 62 | // Else return a handle that corresponds to the mapping. The caller 63 | // must call this->Release(handle) when the returned mapping is no 64 | // longer needed. 65 | virtual Handle* Lookup(const Slice& key) = 0; 66 | 67 | // Release a mapping returned by a previous Lookup(). 68 | // REQUIRES: handle must not have been released yet. 69 | // REQUIRES: handle must have been returned by a method on *this. 70 | virtual void Release(Handle* handle) = 0; 71 | 72 | // Return the value encapsulated in a handle returned by a 73 | // successful Lookup(). 74 | // REQUIRES: handle must not have been released yet. 75 | // REQUIRES: handle must have been returned by a method on *this. 76 | virtual void* Value(Handle* handle) = 0; 77 | 78 | // If the cache contains entry for key, erase it. Note that the 79 | // underlying entry will be kept around until all existing handles 80 | // to it have been released. 81 | virtual void Erase(const Slice& key) = 0; 82 | 83 | // Return a new numeric id. May be used by multiple clients who are 84 | // sharing the same cache to partition the key space. Typically the 85 | // client will allocate a new id at startup and prepend the id to 86 | // its cache keys. 87 | virtual uint64_t NewId() = 0; 88 | 89 | // Remove all cache entries that are not actively in use. Memory-constrained 90 | // applications may wish to call this method to reduce memory usage. 91 | // Default implementation of Prune() does nothing. Subclasses are strongly 92 | // encouraged to override the default implementation. A future release of 93 | // leveldb may change Prune() to a pure abstract method. 94 | virtual void Prune() {} 95 | 96 | // Return an estimate of the combined charges of all elements stored in the 97 | // cache. 98 | virtual size_t TotalCharge() const = 0; 99 | }; 100 | 101 | } // namespace leveldb 102 | 103 | #endif // STORAGE_LEVELDB_INCLUDE_CACHE_H_ 104 | --------------------------------------------------------------------------------