linkedin / cassette Goto Github PK
View Code? Open in Web Editor NEWAn efficient, file-based FIFO Queue for iOS and macOS.
License: BSD 2-Clause "Simplified" License
An efficient, file-based FIFO Queue for iOS and macOS.
License: BSD 2-Clause "Simplified" License
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];
e.g. writeData is deprecated. https://developer.apple.com/documentation/foundation/nsfilehandle/1410936-writedata?language=objc
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.
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.
Instead of writing to the main file, we should create a backup, write to it and then copy it over.
In the following circumstances:
add
, andWe 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
[fileManager fileExistsAtPath:path] is returning true when a user provides a directory (in CASQueueFile.m). The assumption made by the code that path
is a file. We should signal an error instead.
the size of the database file maxes out at 4.26gb or roughtly 4,294,967,295 bytes because of storing _fileLength
as unsigned int
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.