大型 CoreData 存储对 Time Machine 的影响
我正在从事的一个项目可能需要在 CoreData 中存储大量(例如~5GB)的二进制数据。我想知道这是否会对用户的时间机器备份产生负面影响。通过阅读文档,CoreData 的持久存储似乎使用单个文件(例如 XML、SQLite DB 等),因此在我看来,每当用户更改数据存储中的一条数据时,Time Machine 都会将数据存储复制到全部到备份驱动器。
CoreData 是否提供对 Time Machine 更友好的不同数据存储格式?
或者他们有更好的方法来做到这一点?
A project I'm working on potentially entails storing large amounts (e.g. ~5GB) of binary data in CoreData. I'm wondering if this would negatively impact the user's Time Machine backup. From reading the documentation it seems that CoreData's persistent store uses a single file (e.g. XML, SQLite DB, etc) so it would seem to me that any time the user changes a piece of data in the datastore Time Machine would copy the data store in its entirety to the backup drive.
Does CoreData offer a different datastore format that is more Time Machine friendly?
Or is their a better way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用数据模型中的配置将较大的实体分离到不同的持久存储中。您需要自己创建持久性存储协调器,使用 addPersistentStoreWithType:configuration:URL:options:error: 添加具有正确配置的每个存储。
You can use configurations in your data model to separate the larger entities into a different persistent store. You will need to create the persistent store coordinator yourself, using
addPersistentStoreWithType:configuration:URL:options:error:
to add each store with the correct configuration.为了直接回答你的问题,我唯一能想到的就是将你的核心数据存储放在稀疏束磁盘映像中,这样只有更改过的频段才会被时间机器备份。但实际上,我认为如果您尝试在 SQLite/Core Data 中存储这么多数据,您会遇到其他问题。我建议您尝试使用基于磁盘的数据库,例如 PostgreSQL。
To answer your question directly, the only thing I can think of is to put your Core Data store in a sparsebundle disk image, so only the changed bands would be backed up by Time Machine. But really, I think if you're trying to store this much data in SQLite/Core Data you'd run into other problems. I'd suggest you try using a disk-based database such as PostgreSQL.