]> git.apps.os.sepia.ceph.com Git - fscrypt.git/commit
metadata: reorganize and add consistency checks
authorJoe Richey joerichey@google.com <joerichey@google.com>
Wed, 24 May 2017 01:38:38 +0000 (18:38 -0700)
committerJoe Richey joerichey@google.com <joerichey@google.com>
Wed, 31 May 2017 19:35:28 +0000 (12:35 -0700)
commit44c2c7aeda3de09a405ed06aadacbc2c0c7f2a67
tree74bd0fccf5c23a739b434893e1d02c16e0153fca
parent4b6d0ce14b8553a93b2d14fd858dfd35bfd61104
metadata: reorganize and add consistency checks

This commit adds in IsValid() checks for the metadata structures that
let us enforce stronger invariants than those imposed by the protobuf
package. The main uses of this will be to check that metadata is valid
before writing it to the filesystem, and to check that the filesystem
contains valid metadata before returning it to the user. These functions
also will log the exact reason if the validity checks fail.

To have these checks in the metadata package, all of the various
constants have been moved to a single metadata/constants.go file. The
uses of these constants were changed accordingly.

Finally, this commit standardizes our use of errors so that they always
begin with an appropriate prefix.

Change-Id: I99008e2ee803ebe5f6236eb8d83fc83efcd22718
metadata/checks.go [new file with mode: 0644]
metadata/config.go
metadata/config_test.go
metadata/constants.go [new file with mode: 0644]
metadata/metadata.pb.go
metadata/metadata.proto
metadata/policy.go
metadata/policy_test.go