diff options
author | stanisc <stanisc@chromium.org> | 2015-01-12 11:54:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-12 19:56:34 +0000 |
commit | 277354df6e709030559c933b6c8a69836d13a8a2 (patch) | |
tree | 8ced8ad2d4cbc0667c64964ee5bc7e99a85f3f53 /sync/internal_api/public/write_node.h | |
parent | e890fe3c07256d41c2533cd5d5d7268752d2e2c2 (diff) | |
download | chromium_src-277354df6e709030559c933b6c8a69836d13a8a2.zip chromium_src-277354df6e709030559c933b6c8a69836d13a8a2.tar.gz chromium_src-277354df6e709030559c933b6c8a69836d13a8a2.tar.bz2 |
Sync: Support directory entries with unset (implicit) parent ID
This is a part of a larger workitem on supporting datatypes that have implicit
permanent folders. This change prepares Sync directory to handle entries with
unset parent ID. That includes:
1) ParentChildIndex gets ability to resolve an entry without Parent ID to a
datatype root folder based on the entry type.
2) MutableEntity accepts a null Id and gets a constructor overload without
parent ID.
3) Similarly WriteNode accepts initialization with a null parent ID.
4) Added a few extra conditions and checks in the directory validation
routines to handle entries with unset parent ID.
5) Added a few new unit tests.
For now directory entries with implicit parent ID can be created only in test
code. All existing datatypes continue creating entries the old way, with parent ID.
BUG=438313
Review URL: https://codereview.chromium.org/843613002
Cr-Commit-Position: refs/heads/master@{#311090}
Diffstat (limited to 'sync/internal_api/public/write_node.h')
-rw-r--r-- | sync/internal_api/public/write_node.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sync/internal_api/public/write_node.h b/sync/internal_api/public/write_node.h index 2682d017..2d84aae 100644 --- a/sync/internal_api/public/write_node.h +++ b/sync/internal_api/public/write_node.h @@ -34,6 +34,7 @@ class Cryptographer; class WriteTransaction; namespace syncable { +class Id; class Entry; class MutableEntry; } @@ -84,6 +85,12 @@ class SYNC_EXPORT WriteNode : public BaseNode { const BaseNode& parent, const std::string& client_tag); + // InitUniqueByCreation overload for model types without hierarchy. + // The parent node isn't stored but is assumed to be the type root folder. + InitUniqueByCreationResult InitUniqueByCreation( + ModelType model_type, + const std::string& client_tag); + // Looks up the type's root folder. This is usually created by the sync // server during initial sync, though we do eventually wish to remove it from // the protocol and have the client "fake it" instead. @@ -188,6 +195,11 @@ class SYNC_EXPORT WriteNode : public BaseNode { void* operator new(size_t size); // Node is meant for stack use only. + InitUniqueByCreationResult InitUniqueByCreationImpl( + ModelType model_type, + const syncable::Id& parent_id, + const std::string& client_tag); + // Helper to set the previous node. bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT; |