All Projects β†’ thisandagain β†’ Storage

thisandagain / Storage

Licence: mit
An iOS library for fast, easy, and safe threaded disk I/O.

Projects that are alternatives of or similar to Storage

Easystash
πŸ—³Easy data persistence in Swift
Stars: ✭ 303 (+16.99%)
Mutual labels:  storage, disk
lethe
Secure drive wipe
Stars: ✭ 47 (-81.85%)
Mutual labels:  disk, storage
Vagrant Persistent Storage
A Vagrant plugin that creates a persistent storage and attaches it to guest machine.
Stars: ✭ 285 (+10.04%)
Mutual labels:  storage, disk
Winspd
Windows Storage Proxy Driver - User mode disk storage
Stars: ✭ 335 (+29.34%)
Mutual labels:  storage, disk
Binaryprefs
Rapidly fast and lightweight re-implementation of SharedPreferences which stores each preference in files separately, performs disk operations via NIO with memory mapped byte buffers and works IPC (between processes). Written from scratch.
Stars: ✭ 484 (+86.87%)
Mutual labels:  storage, disk
BlobHelper
BlobHelper is a common, consistent storage interface for Microsoft Azure, Amazon S3, Komodo, Kvpbase, and local filesystem written in C#.
Stars: ✭ 23 (-91.12%)
Mutual labels:  disk, storage
Node Disk Manager
Kubernetes Storage Device Management
Stars: ✭ 128 (-50.58%)
Mutual labels:  storage, disk
PSDiskPart
DiskPart PowerShell Module
Stars: ✭ 30 (-88.42%)
Mutual labels:  disk, storage
fbind
A versatile Android mounting utility for folders, EXT4 images, LUKS/LUKS2 encrypted volumes, regular partitions and more.
Stars: ✭ 42 (-83.78%)
Mutual labels:  storage
grapesjs-template-manager
Template and page manager for grapesjs
Stars: ✭ 34 (-86.87%)
Mutual labels:  storage
tar
Memory-efficient, streaming implementation of the tar archive format in Dart
Stars: ✭ 18 (-93.05%)
Mutual labels:  io
ceph-cheatsheet
Allβ„’ you ever wanted to know about operating a Ceph cluster!
Stars: ✭ 84 (-67.57%)
Mutual labels:  storage
nft.storage
πŸ˜‹ Free decentralized storage and bandwidth for NFTs on IPFS and Filecoin.
Stars: ✭ 309 (+19.31%)
Mutual labels:  storage
nativestor
NativeStor provide kubernetes local storage which is light weight and high performance
Stars: ✭ 20 (-92.28%)
Mutual labels:  storage
Naos
A mildly opiniated modern cloud service architecture blueprint + reference implementation
Stars: ✭ 19 (-92.66%)
Mutual labels:  storage
benji
πŸ“ This library is a Scala reactive DSL for object storage (e.g. S3/Amazon, S3/CEPH, Google Cloud Storage).
Stars: ✭ 18 (-93.05%)
Mutual labels:  storage
Arozos
General purposed Web Desktop Operating Platform / OS for Raspberry Pis, Now written in Go!
Stars: ✭ 252 (-2.7%)
Mutual labels:  storage
localDataStorage
πŸ’Ό A handy wrapper for HTML5 localStorage that seamlessly gets/sets primitive values (Array, Boolean, Date, Float, Integer, Null, Object or String); provides simple data scrambling; intelligently compresses strings; permits query by key as well as query by value and promotes shared storage segmentation in the same domain. Key names and values ar…
Stars: ✭ 42 (-83.78%)
Mutual labels:  storage
aus driver amazon s3
Provides a TYPO3 FAL driver for the Amazon Web Service S3
Stars: ✭ 15 (-94.21%)
Mutual labels:  storage
ioBroker.history
manages state history
Stars: ✭ 26 (-89.96%)
Mutual labels:  storage

Storage

Persist all the things! Wheee!

In attempting to keep things DRY, EDStorage was created to address the fair amount of boilerplate that often gets created to deal with writing data to disk within iOS applications in a performant manner. Disk I/O within iOS is synchronous and so much of this boilerplate is often written to improve performance by moving I/O to a background thread. EDStorage accomplishes this by transforming each write instance into a NSOperation which is managed by a single NSOperationQueue. All of this is done in the background while providing high-level methods to the user via categories.

EDStorage strives to provide three things:

  • An abstract interface based on categories that makes persisting data to disk simple.
  • A highly generic management interface that makes extending EDStorage equally simple.
  • Speed and safety.

Basic Use

The easiest way to get going with EDStorage is to take a look at the included example application. The Xcode project file can be found in example > storage.xcodeproj.

In order to include EDStorage in your project, you'll want to add the entirety of the EDStorage directory to your project. EDStorage is built on top of foundation libraries and so no additional frameworks are needed. To bring in all of the included storage categories, simply:

#import "EDStorage.h"

Each category has a slightly different interface depending on the needs of a specific class, but to use a common example, let's look at how to persist a UIImage to the application cache directory:

- (void)doSomething
{
    UIImage *image = [UIImage imageNamed:@"keyboardCat.png"];
    
    [image persistToCache:^(NSURL *url, NSUInteger size) {
        NSLog(@"FTW!: %@ | %d bytes", url, size);
    } failure:^(NSError *error) {
        NSLog(@"UH OH: %@", error);
    }];
}

Persisting to the temporary and documents application directories is equaly simple:

[image persistToTemp:^(NSURL *url, NSUInteger size) {
    NSLog(@"FTW!: %@ | %d bytes", url, size);
} failure:^(NSError *error) {
    NSLog(@"UH OH: %@", error);
}];
[image persistToDocuments:^(NSURL *url, NSUInteger size) {
    NSLog(@"FTW!: %@ | %d bytes", url, size);
} failure:^(NSError *error) {
    NSLog(@"UH OH: %@", error);
}];

Implementing A Storage Category

EDStorageManager provides a single block method for interfacing with categories:

- (void)persistData:(id)data withExtension:(NSString *)ext toLocation:(Location)location success:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;

Categories simply abstract the process of calling this method on EDStorageManager by handling conversion of the class instance into a NSData object. See the NSData+Storage implementation For example, the storage category for UIImage simply passes self into NSData by calling UIImageJPEGRepresentation().

If you create a category that you find useful, please let me know! Pull requests are welcome.


Locations

EDStorageDirectoryCache
EDStorageDirectoryTemp
EDStorageDirectoryDocuments

NSData+Storage Methods

- (void)persistToCacheWithExtension:(NSString *)extension success:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;
- (void)persistToTempWithExtension:(NSString *)extension success:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;
- (void)persistToDocumentsWithExtension:(NSString *)extension success:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;

NSDictionary+Storage Methods

- (void)persistToCache:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;
- (void)persistToTemp:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;
- (void)persistToDocuments:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;

UIImage+Storage Methods

- (void)persistToCache:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;
- (void)persistToTemp:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;
- (void)persistToDocuments:(void (^)(NSURL *url, NSUInteger size))success failure:(void (^)(NSError *error))failure;

iOS Support

EDStorage is tested on iOS 5 and up. Older versions of iOS may work but are not currently supported.

ARC

EDStorage as of v0.2.0 is built using ARC. If you are including EDStorage in a project that does not use Automatic Reference Counting (ARC), you will need to set the -fobjc-arc compiler flag on all of the EDStorage source files. To do this in Xcode, go to your active target and select the "Build Phases" tab. Now select all EDStorage source files, press Enter, insert -fobjc-arc and then "Done" to enable ARC for EDStorage.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].