Rocket Data provides a simple, synchronous API to manage immutable models. Each user of the library owns a data provider which wraps the immutable model. You can set and edit data providers synchronously. Under the hood, any changes are asynchronously propagated to other data providers and the cache. This allows your application logic to be simple and your model management to never block the main thread or slow down your app.
Rocket Data 提供了简单的、同步更新的api去管理那些不可变的模型。库中的每个data provider 都持有不可变的模型。你可以同步编辑、设置data provider。在这个第三方库中，任何数据的更新都会异步通知data provider和缓存。这样使你的app逻辑变得简单，并且永远不会阻塞主线程或使app变的卡顿。
To setup the library in your app, you need to do a few steps:
1、Implement your CacheDelegate
2、Create your DataModelManager
3、Make your models implement the Model or SimpleModel protocol
4、(Optional) Add extensions to classes for a simpler API
The ability to create new models by mapping on old models. The protocol allows the library to iterate over child nodes (and then recursively iterate over the whole tree) and then replace these models with updated models. This ability is not required by SimpleModel and therefore will not get consistency for child models.
Rocket Data supports deleting models. When a model is deleted, the map function in the Model protocol will return nil for a model. This means the model should remove this child model. If the child model is required, we recommend you cascade this delete and return nil for the current model. You do not need to worry about this for SimpleModels.
func merge(_ model: Model) -> Model 这里主要处理什么呢 ？看看注释里写的
Optional method. Do not implement this method unless you want to support projections (not common).
Data providers are the main interface with the library and most of your code will interact with data providers. They are a wrapper around an immutable model or models. They listen to any changes on their models and notify their delegate whenever something changes. There are two types of data providers: DataProvider and CollectionDataProvider.
DataProviders are backed by a DataModelManager. The initializer requires you pass in a DataModelManager, but you can simplify this API with an extension. See Setup for more info.
DataProviders also offer the ability to pause updates. See Other Features.