Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial metadata store implementation #165

Merged
merged 1 commit into from
Feb 26, 2016
Merged

initial metadata store implementation #165

merged 1 commit into from
Feb 26, 2016

Conversation

reset
Copy link
Collaborator

@reset reset commented Jan 21, 2016

This is the first pass at adding a metadata storage to the Depot server

  • Repo server stores metadata in lmdb, an embedded in-memory database
  • Added PackageIdent struct which encapsulates functionality which was sprinkled throughout modules in the codebase for working with package identifiers. This struct is passed as an argument to many functions which previously took either four &strs or two &strs and two Option<&str>s
  • Added DataStore struct which encapsulates the lmdb environment and all databases
  • Added PkgDatabase which is populated from reading the metadata files of package archives
  • Added PkgIndex which is a special database that allows sorted duplicate data to form an index. This database can be queried to find the latest version of a package using a cursor.
  • Added ViewDatabase which contains the names of repositories and the packages which are a part of them. This allows us to segregate particular packages to only being available in certain environments while not duplicating data on disk for the actual package archive.
  • Added data_store and data_object modules which contain an abstraction on top of the FFI layer of lmdb
  • Add new command line option depot-repair
  • Add new command line option repo-create
  • Add new command line option repo-list
  • Uploading a package which already exists on the depot will no longer result in a forced upload
  • Moved package archive specific functions to package::archive module from package

Known Issues

  • Starting multiple transactions from different threads is not currently working. Additional child transactions can be started, but not root transactions. This behaviour should be possible within LMDB.
  • Cursor functions don't return useable values for keys, but the data of the current item is good to read and available

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@reset reset force-pushed the datastore branch 2 times, most recently from baa1ef3 to 6ab47b7 Compare January 22, 2016 12:47
@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@reset reset force-pushed the datastore branch 3 times, most recently from 4dad098 to b607447 Compare January 27, 2016 13:43
@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@reset reset force-pushed the datastore branch 6 times, most recently from baedafa to bb11e49 Compare January 29, 2016 06:49
}

impl<'a> From<&'a str> for PackageIdent {
fn from(value: &'a str) -> PackageIdent {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

PackageIdent {
derivation: deriv.into(),
name: name.into(),
version: version.map(|v| v.into()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever!

@fnichol
Copy link
Collaborator

fnichol commented Feb 25, 2016

When I try to run bldr depot, it looks like the data directory isn't created if it does not exist:

root@398e53586e8b:/src# bldr depot
bldr(MN): Starting Bldr Depot at /opt/bldr/srvc/bldr/data
bldr(CR): Repo listening on 0.0.0.0:9632
bldr(DS)[src/bldr/repo/data_store.rs:451:24]: Undefined(2, "No such file or directory")

root@398e53586e8b:/src# ls /opt/bldr/srvc/bldr/data
ls: cannot access /opt/bldr/srvc/bldr/data: No such file or directory

root@398e53586e8b:/src# mkdir -p /opt/bldr/srvc/bldr/data

root@398e53586e8b:/src# bldr depot
bldr(MN): Starting Bldr Depot at /opt/bldr/srvc/bldr/data
bldr(CR): Repo listening on 0.0.0.0:9632

Can we ensure that the data directory exists before starting the depot?

@reset
Copy link
Collaborator Author

reset commented Feb 25, 2016

@fnichol absolutely, good catch!

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@reset reset force-pushed the datastore branch 2 times, most recently from 9101246 to e2b73f4 Compare February 26, 2016 06:01
@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@reset
Copy link
Collaborator Author

reset commented Feb 26, 2016

Ok, this PR contains the fixes that @adamhjk and I spoke about on video chat last night. I'm going to merge this one in so we're ready for demos tomorrow!

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@reset
Copy link
Collaborator Author

reset commented Feb 26, 2016

@delivery approve

gif-keyboard-6870312083124677658

@chef-delivery
Copy link
Contributor

Failed to unknown change: afd21805-27c3-4cf2-b3d6-25462315f5d6
Delivery does not understand this command. @reset

@reset
Copy link
Collaborator Author

reset commented Feb 26, 2016

@delivery approve

chef-delivery added a commit that referenced this pull request Feb 26, 2016
Merged change afd21805-27c3-4cf2-b3d6-25462315f5d6

From review branch datastore into master

Signed-off-by: reset <[email protected]>
@chef-delivery chef-delivery merged commit 8554671 into master Feb 26, 2016
@chef-delivery chef-delivery deleted the datastore branch February 26, 2016 08:10
@chef-delivery
Copy link
Contributor

This PR has passed 'Acceptance' and is ready to be delivered!
Use: '@delivery deliver' when validated in acceptance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants