> That makes me nervous for a number of reasons…
And now me too :-) I can certainly alter my approach. It's not too late for my project. * A user can move a document at any time, but there is no support in > Couchbase Lite for a database being moved while it’s open. I don’t know if > SQLite can handle this without hand-holding; I know ForestDB can’t. And the > CBLManager and the attachment store both keep absolute paths and assume > they don’t change. The NSDocument's setFileURL method will be called if the document is moved by another process, so I was going to override this and close the database and re-set the CBLManager's URL and re-open it with the new URL. * Every database has a unique ID that’s used as part of storing checkpoints > for replication. If you copy a document containing a database, you now have > two copies of the same database, with the same UUID (which is no longer > unique). That’s going to mess up checkpointing because both instances of > the database will try to store the same checkpoint on the server. This > isn’t fatal, but it will greatly slow down replication, because when it > happens the replicator has to ignore the checkpoint and start over from > scratch. This could be problematic even without a document based database. A user could easily copy the same database file to multiple devices and then start replication. Does the replicator automatically detect this situation and automatically start replication from scratch? That would be ok if it did I think. Although I don't know if the replicator would set a new unique UUID for one of the databases so maybe this will be constantly problematic. What's the best way to handle this situation? * Databases may internally store sensitive information like login session > cookies, as part of the replicator’s saved state. This also could be a problem. Especially if the user gives a copy of their database to someone else. This can happen to anyone I guess and not just for my NSDocument idea. Thanks, Brendan On Tuesday, July 7, 2015 at 11:45:09 PM UTC-6, Jens Alfke wrote: > > > On Jul 7, 2015, at 10:29 PM, Brendan Duddridge <[email protected] > <javascript:>> wrote: > > Well I'm actually embedding the database into an NSDocument/UIDocument > NSFileWrapper (kind of like a UIManagedDocument) so users can share the > actual document files if they like > > > That makes me nervous for a number of reasons… > > * A user can move a document at any time, but there is no support in > Couchbase Lite for a database being moved while it’s open. I don’t know if > SQLite can handle this without hand-holding; I know ForestDB can’t. And the > CBLManager and the attachment store both keep absolute paths and assume > they don’t change. > > * Every database has a unique ID that’s used as part of storing > checkpoints for replication. If you copy a document containing a database, > you now have two copies of the same database, with the same UUID (which is > no longer unique). That’s going to mess up checkpointing because both > instances of the database will try to store the same checkpoint on the > server. This isn’t fatal, but it will greatly slow down replication, > because when it happens the replicator has to ignore the checkpoint and > start over from scratch. > > * Databases may internally store sensitive information like login session > cookies, as part of the replicator’s saved state. > > I could probably think of more problems if I thought about this longer :) > > None of these are insurmountable, but they’d require significant > engineering work inside Couchbase Lite, and no one before has ever > expressed a need for databases-as-documents so it hasn’t come up as a > potential feature. > > —Jens > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/1803125b-8744-4731-b68f-94dc0ea07163%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
