这是indexloc提供的服务,不要输入任何密码
Skip to content

Discussion: A splittening of mycelium #527

@jamesmunns

Description

@jamesmunns

I've chatted with @hawkw about potentially splitting out some parts of mycelium, particularly crates
that have found life outside of the mycelium project. Eliza mentioned that keeping history was important,
and would prefer using a tool that preserved historical commits relevant to each sub-project.

I took a quick crack at this, using git-filter-repo with these instructions, to automatically extract sub-paths.

The following notes are from running the subdirectory-filter command on the current
version of the mycelium repo, SHA: 435f3102f3e58f6a346aa3d310505d863bd47bcc.

Four subprojects were considered, as they have external usage:

  • cordyceps
  • maitake
  • maitake-sync
  • mycelium-bitfield

This process seems to work well, with the following caveats:

  • All projects will need fixup commits to restore common items above their subfolders, such
    as .gitignore and relevant GH Actions CI steps
  • All crates will need to be updated to point to a new home repo
  • Some crates use relative paths (maitake-sync, maitake), would need at least one
    fixup commit
  • maitake requires publishing, refactoring-out, or switching to a git-dep of
    mycelium-util before it could be extracted.
  • maitake-sync has some history in the maitake folder before it was extracted.
    if we wanted to preserve that, it would require some additional touch-ups.

If we only want the HISTORY, and not to guarantee that historical commits still build, then
we are likely good to go for cordyceps, maitake-sync, and maitake-bitfield.

Additional work would be required to enable historical builds.

Notes for each sub-project:

maitake-sync

git filter-repo --subdirectory-filter maitake-sync

  • Retained 42 commits
  • Only has history since maitake-sync was extracted from maitake (Sep 2023)
  • Has relative deps, which means it does not build (easy to fix)
    • cordyceps
    • mycelium-bitfield
  • Does not have CI/gh actions
  • Does not have gitignore

cordyceps

git filter-repo --subdirectory-filter cordyceps

  • Retained 135 commits
  • Builds clean
  • Does not have CI/gh actions
  • Does not have gitignore

maitake

git filter-repo --subdirectory-filter maitake

  • Retained 155 commits
  • Has relative deps, which means it does not build (3/4 easy to fix, m-util is harder)
    • mycelium-bitfield
    • mycelium-util
    • maitake-sync
    • cordyceps
  • Does not have CI/gh actions
  • Does not have gitignore
  • Has a dependency on mycelium-util, which is not published. Will require
    additional work to extract.

Uses of mycelium-util (non-exhaustive):

// mycelium/maitake/src/loom.rs:
pub use mycelium_util::sync::spin;
// mycelium/maitake/src/scheduler.rs:
#[cfg(any(feature = "tracing-01", feature = "tracing-02", test))]
use mycelium_util::fmt;
use mycelium_util::sync::Lazy;
// mycelium/maitake/src/task.rs:
use mycelium_util::{fmt, mem::CheckedMaybeUninit};
// mycelium/maitake/src/trace.rs:
use mycelium_util::fmt;
// mycelium/maitake/src/scheduler/steal.rs:
use mycelium_util::fmt;
// mycelium/maitake/src/scheduler/tests/alloc_tests.rs:
use mycelium_util::sync::Lazy;
// mycelium/maitake/src/task/join_handle.rs:
use mycelium_util::fmt;
// mycelium/maitake/src/task/state.rs:
use mycelium_util::unreachable_unchecked;
// mycelium/maitake/src/task/task_list.rs:
use mycelium_util::intrusive::list;
// mycelium/maitake/src/time/timer.rs:
use mycelium_util::fmt;
// mycelium/maitake/src/time/timer/sleep.rs:
use mycelium_util::fmt;
// mycelium/maitake/src/time/timer/wheel.rs:
use mycelium_util::fmt;
// mycelium/maitake/tests/scheduler/alloc.rs:
use mycelium_util::sync::{blocking::Mutex, spin::Spinlock, Lazy};

mycelium-bitfield

git filter-repo --subdirectory-filter bitfield

  • Retained 59 commits
  • Builds clean
  • Does not have CI/gh actions
  • Does not have gitignore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions