GithubHelp home page GithubHelp logo

linkedin / cassette Goto Github PK

View Code? Open in Web Editor NEW
95.0 95.0 17.0 455 KB

An efficient, file-based FIFO Queue for iOS and macOS.

License: BSD 2-Clause "Simplified" License

Objective-C 96.52% Ruby 0.77% C 0.70% Swift 1.56% Shell 0.43%

cassette's People

Contributors

bhamiltoncx avatar dmaclach avatar f2prateek avatar jmkk avatar li-kramgopa avatar ls-andrew-goodale avatar nadohs avatar nikhilbedi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cassette's Issues

+unarchiveObjectWithData: deprecated in iOS12 & macosx10.14

NSUnarhiver unarchiveObjectWithData: is deprecated for
macosx-10.14 and ios 12.0

+ (nullable id)unarchiveObjectWithData:(NSData *)data API_DEPRECATED("Use +unarchivedObjectOfClass:fromData:error: instead", macosx(10.2,10.14), ios(2.0,12.0), watchos(2.0,5.0), tvos(9.0,12.0));

This is way only way I have found that works to do the same thing without the deprecated methods:

NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:data error:nil];
[unarchiver setRequiresSecureCoding:NO];
CustomObject *object = [unarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];

Consider removing the "commitFile" logic from CASQueueFile

CASQueueFile writes its header to a a temporary commitFile with comments suggesting it should try and recover from failure when updating the metadata header.

This logic does not exist in the Java implementation of tape.

Worse yet, the Objective-C implementation does not actually recover from failure; it silently discards the queue file entirely and pretends like the queue was empty.

Probably this logic should just be deleted. Either we assume the OS writes the header atomically (in which case we don't need the temporary commitFile), or we need to write the entire queue (header and data) to a temporary file, then rename the temporary file over the real file.

remove `CASFileObjectQueue` `relativePath` option.

If we want the library to not be involved with folder management, file management, and want to require users to create intermediary directories themselves, having the relativePath option no longer makes sense.

Atomic Writes

Instead of writing to the main file, we should create a backup, write to it and then copy it over.

Durability Issue

In the following circumstances:

  • when expanding the database file during an add, and
  • when an existing entry is wrapped around the end of the database file (since this is a ring buffer)

We erase the old wrapped tail, prior to updating the database header.
https://github.com/linkedin/cassette/blob/master/Cassette/CASQueueFile.m#L453

        [self ringEraseAtPosition:QueueFileHeaderLength length:count];

Although the window is small, if a crash occurs during this period it will result in corrupted data.


This solution should be simple, removing the line in question is most likely all we need

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.