Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_OBSERVED_LEAF_H_ | |
| 6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_OBSERVED_LEAF_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "base/optional.h" | |
| 11 #include "base/time/time.h" | |
| 12 #include "net/cert/merkle_tree_leaf.h" | |
| 13 | |
|
Ryan Sleevi
2016/06/30 22:48:18
should be in the certificate_transparency namespac
Eran Messeri
2016/07/01 13:24:00
Moved to the SingleTreeTracker class.
| |
| 14 // Represents a MerkleTreeLeaf with additional metadata: The time it was | |
| 15 // first observed by this client and the index of the MerkleTreeLeaf in | |
| 16 // the log, if known. | |
| 17 class ObservedLeaf { | |
|
Ryan Sleevi
2016/06/30 22:48:18
1) Why do we need a dedicated class for this?
2) W
Eran Messeri
2016/07/01 13:24:00
I've significantly changed this class and moved it
| |
| 18 public: | |
| 19 ObservedLeaf(net::ct::MerkleTreeLeaf&& leaf, const base::Time& observed_at); | |
| 20 ObservedLeaf(const ObservedLeaf& other); | |
| 21 ObservedLeaf(ObservedLeaf&&); | |
| 22 ~ObservedLeaf(); | |
| 23 | |
| 24 // Sets the index of the leaf in the tree. May be called only once per | |
| 25 // instance. | |
| 26 void SetLeafIndex(uint64_t index); | |
|
Ryan Sleevi
2016/06/30 22:48:18
Use vertical whitespace (between each and every on
Eran Messeri
2016/07/01 13:24:00
Done.
| |
| 27 // Returns true if the leaf index was set for this instance. | |
| 28 bool HasLeafIndex() const; | |
| 29 // Returns the leaf index. May only be called on an instance where | |
| 30 // SetLeafIndex | |
| 31 // was called. | |
|
Ryan Sleevi
2016/06/30 22:48:18
line wrapping
Eran Messeri
2016/07/01 13:24:00
Done.
| |
| 32 uint64_t GetLeafIndex() const; | |
|
Ryan Sleevi
2016/06/30 22:48:18
DESIGN: API design wise, "May only be called ..."
Eran Messeri
2016/07/01 13:24:00
Can you elaborate? Also, is it a significant issue
| |
| 33 // The actual tree leaf. | |
| 34 const net::ct::MerkleTreeLeaf& GetLeaf() const; | |
| 35 // The time the leaf was observed. | |
| 36 const base::Time& ObservedAt() const; | |
| 37 | |
| 38 private: | |
| 39 // The entire leaf for the certificate. | |
| 40 const net::ct::MerkleTreeLeaf leaf_; | |
| 41 // When the leaf for the particular certificate was first seen. | |
| 42 const base::Time observed_at_; | |
| 43 // The leaf's index in the tree. Only set if the index has been | |
| 44 // obtained from the log. | |
| 45 base::Optional<uint64_t> leaf_index_; | |
| 46 }; | |
| 47 | |
| 48 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_OBSERVED_LEAF_H_ | |
| OLD | NEW |