[SERVER-28605] Implement KeysCollectionDocument Created: 04/Apr/17  Updated: 05/Sep/18  Resolved: 07/Apr/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.5.5
Fix Version/s: 3.5.6

Type: Task Priority: Major - P3
Reporter: Randolph Tan Assignee: Jack Mulrow
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-12026 Document system.keys in the manual Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2017-04-17
Participants:

 Description   

Implement class for parsing and serializing a admin.system.keys document:

{
    _id: <int>,
    purpose: 'signLogicalTime',
    key: <20 byte key generated with secure PRNG in BinData>,
    expiresAt: <LogicalTime, currently Timestamp format>
}

class KeysCollectionDocument {
public:
    KeysCollectionDocument(long long keyId, std::string purpose, TimeProofService::Key key, LogicalTime expiresAt);
    static StatusWith<TypeKeys> fromBSON(const BSONObj& doc);
    BSONObj toBSON() const;
 
    // getter methods
};



 Comments   
Comment by Githook User [ 07/Apr/17 ]

Author:

{u'username': u'jsmulrow', u'name': u'Jack Mulrow', u'email': u'jack.mulrow@mongodb.com'}

Message: SERVER-28605 Implement KeysCollectionDocument
Branch: master
https://github.com/mongodb/mongo/commit/f2e400cce0948f8274e84b54c7da2b1e3d9dc2a5

Comment by Andy Schwerin [ 07/Apr/17 ]

OK. Let's refrain from writing parsers by hand in the future, in favor of autogeneration.

Comment by Misha Tyulenev [ 06/Apr/17 ]

schwerin this CR is already lgtm - the only thing left it to push it. May be we can use IDL for the next jira where we need to parse any message so we dont need to reimplement the task?

Comment by Randolph Tan [ 06/Apr/17 ]

schwerin I just talked with Mark and it looks like the current code in master has everything this work would need (assuming that it works perfectly).

Comment by Andy Schwerin [ 05/Apr/17 ]

Would it be possible to use the new IDL to generate the parser and
serializer?

Comment by Andy Schwerin [ 05/Apr/17 ]

This might be a good candidate for using the new IDL to generate the parser and serializer.

Comment by Misha Tyulenev [ 05/Apr/17 ]

Ok. I updated the spec.

Comment by Randolph Tan [ 05/Apr/17 ]

Oh, yeah. I forgot to put static. We also need to be able to create new instances and serialize them to BSON (when creating new key documents)

Comment by Misha Tyulenev [ 05/Apr/17 ]

overall lgtm:
nits:

  • I prefer to call the type KeysCollectionDocument (open for better names)
  • If passing arguments by value must always ensure it std::move's into the c-tor
  • are we always using this type just for instantiating from bson? If so than why not make c-tor private and fromBson static? i.e. the only way to create the KeysCollectionDoc will be

    auto key = KeysCollectionDoc::fromBSON(doc)
    

Comment by Randolph Tan [ 04/Apr/17 ]

misha.tyulenev can you take a quick look at the description and let us know if you have any comments

Generated at Thu Feb 08 04:18:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.