Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

API tweaks #40

Open
1 task
dhardy opened this issue May 16, 2016 · 8 comments
Open
1 task

API tweaks #40

dhardy opened this issue May 16, 2016 · 8 comments

Comments

@dhardy
Copy link
Owner

dhardy commented May 16, 2016

Some details of the API are open to tweaking.

  • Code tag: #0040
@dhardy
Copy link
Owner Author

dhardy commented May 16, 2016

  • discover recursivity & following links

The discover module uses the walkdir crate to recursively files. This crate uses a builder pattern to allow restriction of the depth of the walk and control whether links are followed; it would be nice to expose these options — preferably via named default function arguments, but this feature is not (yet) available in Rust.

@dhardy dhardy changed the title API details API tweaks May 16, 2016
@dhardy
Copy link
Owner Author

dhardy commented May 16, 2016

  • discover with partial paths

The discover functions could support partial paths. Example:

$ ls samples/repo-seq-small/
pn1-ss0-cl0.piplog  pn1-ss0.pip  pn1-ss1.pip
$ cargo run --example pippincmd -- -PSL samples/repo-seq-small/pn1-ss

@dhardy
Copy link
Owner Author

dhardy commented May 24, 2016

In the Partition type:

  • the way user_fields are passed to write and write_snapshot may want to be different
  • returning file headers from load and load_range (or via other methods) might be useful

@dhardy
Copy link
Owner Author

dhardy commented May 24, 2016

  • Is there a way of auto-boxing structs passed to Partition::open, create (and repo equivalents)?

Yes, but I think it's probably not worth doing (partly because I don't wish to make these methods into templates).

@dhardy
Copy link
Owner Author

dhardy commented Jul 25, 2016

  • UserFields & MakeMeta

Currently these get passed into nearly all methods which might use them, and some (e.g. Partition::create) now require two: user: Option<&mut UserFields>, make_meta: Option<&MakeMeta>. Partition::create(io, "replay part", None, None) is not so pretty.

@dhardy
Copy link
Owner Author

dhardy commented Jul 25, 2016

  • Lists/maps of things within structs

Several struts store lists/sets/maps which should be user-readable: elements within a PartState, states, commits and "pending commits" within a Partition, changes within a Commit. Sometimes the underlying type can be accessed via a method which is convenient but fixes the type. Sometimes only a limited set of operations is possible.

@dhardy
Copy link
Owner Author

dhardy commented Dec 28, 2016

  • Move want_snapshot out of PartIO?

Rationale: it's there to allow configuration of when snapshots are made, not how data is loaded/saved; additionally, the discover module provides a ready-to-use implementation of PartIO but it's not obvious how to do this while still allowing customisation of another method in the same trait.

@dhardy
Copy link
Owner Author

dhardy commented Feb 26, 2017

  • Revise user-field funcs?

We have the following. Should snapshot and log file numbers be passed?

fn make_user_data(&mut self, _header: &FileHeader) -> Result<Vec<UserData>>;
fn read_header(&mut self, _header: &FileHeader) -> Result<()>;

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

No branches or pull requests

1 participant