mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-03-12 09:29:11 +00:00
Merge branch 'main' into block-downloader
This commit is contained in:
commit
851a898b03
9 changed files with 144 additions and 35 deletions
80
.github/labeler.yml
vendored
Normal file
80
.github/labeler.yml
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
# This file consists of rules determining which labels the
|
||||
# `github-actions` bot should automatically label an issue/PR with.
|
||||
# The CI that actually applies labels is in `.github/workflows/labeler.yml`.
|
||||
#
|
||||
# The main one used is the "if a file changed" rule.
|
||||
# The format for this rule is:
|
||||
#
|
||||
# ```
|
||||
# $LABEL_NAME:
|
||||
# - changed-files:
|
||||
# - any-glob-to-any-file: $PATH
|
||||
# ```
|
||||
#
|
||||
# where $PATH can be:
|
||||
# $DIRECTORY/*
|
||||
# which means any file changed 1 level deep inside that directory or:
|
||||
# $DIRECTORY/**
|
||||
# which means any file changed within that directory or:
|
||||
# $DIRECTORY/$FILE_NAME
|
||||
# which means a specific file path or:
|
||||
# $DIRECTORY/*.$FILE_EXTENSION
|
||||
# which means any file 1 level deep in that directory with a certain file extension.
|
||||
#
|
||||
# For a detailed guide, see: <https://github.com/actions/labeler>.
|
||||
#
|
||||
# For a real example:
|
||||
A-consensus: # This is the tag name
|
||||
- changed-files: # Any changed file...
|
||||
- any-glob-to-any-file: consensus/** # ...within the `consensus/` directory
|
||||
# will cause the `github-actions` bot
|
||||
# to add the `A-consensus` tag.
|
||||
|
||||
A-cryptonight:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: cryptonight/**
|
||||
|
||||
A-database:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: database/**
|
||||
|
||||
A-helper:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: helper/**
|
||||
|
||||
A-net:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: net/**
|
||||
|
||||
A-p2p:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: p2p/**
|
||||
|
||||
A-pruning:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: pruning/**
|
||||
|
||||
A-test-utils:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: test-utils/**
|
||||
|
||||
A-types:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: types/**
|
||||
|
||||
A-ci:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: .github/**
|
||||
|
||||
A-dependency:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '**/Cargo.toml' # Any Cargo file in the entire repo
|
||||
- any-glob-to-any-file: '**/Cargo.lock'
|
||||
|
||||
A-workspace:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '*' # Any root file change
|
||||
|
||||
A-docs:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '**/*.md' # Any file in the entire repo ending in `.md`
|
25
.github/workflows/labeler.yml
vendored
Normal file
25
.github/workflows/labeler.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
# This action automatically applies GitHub labels
|
||||
# based on the rules in the `.github/labeler.yml` file.
|
||||
#
|
||||
# For more info:
|
||||
# - <https://github.com/actions/labeler>
|
||||
# - <https://github.com/tokio-rs/tokio/blob/6c42d286b343f498ce29de2aab9358a0aedb081c/.github/workflows/labeler.yml>
|
||||
|
||||
name: "Labeler"
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
labeler:
|
||||
permissions:
|
||||
contents: read # for actions/labeler to determine modified files
|
||||
pull-requests: write # for actions/labeler to add labels to PRs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v5
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
sync-labels: true
|
|
@ -38,3 +38,31 @@ After that, ensure all lints, tests, and builds are successful by running:
|
|||
- Sort imports as core, std, third-party, Cuprate crates, current crate.
|
||||
- Follow the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines)
|
||||
- Break the above rules when it makes sense
|
||||
|
||||
## Keeping track of issues and PRs
|
||||
The Cuprate GitHub repository has a lot of issues and PRs to keep track of. Cuprate makes use of generic labels and labels grouped by a prefixes to help with this.
|
||||
|
||||
Some labels will be [automatically added/removed](https://github.com/Cuprate/cuprate/tree/main/.github/labeler.yml) if certain file paths have been changed in a PR.
|
||||
|
||||
The following section explains the meaning of various labels used.
|
||||
This section is primarily targeted at maintainers. Most contributors aren't able to set these labels.
|
||||
|
||||
| Labels | Description | Example |
|
||||
|--------------|-------------|---------|
|
||||
| [A-] | The **area** of the project an issue relates to. | `A-database`, `A-rpc`, `A-docs`
|
||||
| [C-] | The **category** of an issue. | `C-cleanup`, `C-optimization`
|
||||
| [D-] | Issues for **diagnostics**. | `D-confusing`, `D-verbose`
|
||||
| [E-] | The **experience** level necessary to fix an issue. | `E-easy`, `E-hard`
|
||||
| [I-] | The **importance** of the issue. | `I-crash`, `I-memory`
|
||||
| [O-] | The **operating system** or platform that the issue is specific to. | `O-windows`, `O-macos`, `O-linux`
|
||||
| [P-] | The issue **priority**. These labels can be assigned by anyone that understand the issue and is able to prioritize it, and remove the [I-prioritize] label. | `P-high`, `P-low`
|
||||
| [wontfix] | Indicates an issue will not be fixed. | |
|
||||
|
||||
[A-]: https://github.com/Cuprate/cuprate/labels?q=A
|
||||
[C-]: https://github.com/Cuprate/cuprate/labels?q=C
|
||||
[D-]: https://github.com/Cuprate/cuprate/labels?q=D
|
||||
[E-]: https://github.com/Cuprate/cuprate/labels?q=E
|
||||
[I-]: https://github.com/Cuprate/cuprate/labels?q=I
|
||||
[O-]: https://github.com/Cuprate/cuprate/labels?q=O
|
||||
[P-]: https://github.com/Cuprate/cuprate/labels?q=P
|
||||
[wontfix]: https://github.com/Cuprate/cuprate/labels?q=wontfix
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Boog900
|
||||
Copyright (c) 2023-2024 Cuprate Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
|
@ -1,6 +1,5 @@
|
|||
Cuprate crates are licensed under one of two licenses, either MIT or AGPL-3.0,
|
||||
depending on the crate in question. Each crate declares their license in their
|
||||
`Cargo.toml` and includes a `LICENSE` file detailing its status. Additionally,
|
||||
a full copy of the AGPL-3.0 License is included in the root of this repository
|
||||
as a reference text. This copy should be provided with any distribution of a
|
||||
crate licensed under the AGPL-3.0, as per its terms.
|
||||
`Cargo.toml`. Additionally, a full copy of both licenses are included in the
|
||||
root of this repository for reference. These copies should be provided with
|
||||
any distribution of a crate, as per the respective license's terms.
|
||||
|
|
|
@ -85,8 +85,6 @@ impl Default for ResizeAlgorithm {
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Free functions
|
||||
/// Cached result of [`page_size()`].
|
||||
static PAGE_SIZE: OnceLock<NonZeroUsize> = OnceLock::new();
|
||||
/// This function retrieves the system’s memory page size.
|
||||
///
|
||||
/// It is just [`page_size::get`](https://docs.rs/page_size) internally.
|
||||
|
@ -97,6 +95,8 @@ static PAGE_SIZE: OnceLock<NonZeroUsize> = OnceLock::new();
|
|||
/// This function will panic if the OS returns of page size of `0` (impossible?).
|
||||
#[inline]
|
||||
pub fn page_size() -> NonZeroUsize {
|
||||
/// Cached result of [`page_size()`].
|
||||
static PAGE_SIZE: OnceLock<NonZeroUsize> = OnceLock::new();
|
||||
*PAGE_SIZE
|
||||
.get_or_init(|| NonZeroUsize::new(page_size::get()).expect("page_size::get() returned 0"))
|
||||
}
|
||||
|
|
|
@ -78,17 +78,16 @@ macro_rules! impl_path_oncelock_and_fn {
|
|||
$(#[$attr:meta])* // Documentation and any `derive`'s.
|
||||
$fn:ident, // Name of the corresponding access function.
|
||||
$dirs_fn:ident, // Name of the `dirs` function to use, the PATH prefix.
|
||||
$once_lock:ident, // Name of the `OnceLock`.
|
||||
$sub_dirs:literal // Any sub-directories to add onto the PATH.
|
||||
),* $(,)?) => {$(
|
||||
/// Local `OnceLock` containing the Path.
|
||||
static $once_lock: OnceLock<PathBuf> = OnceLock::new();
|
||||
|
||||
// Create the `OnceLock` if needed, append
|
||||
// the Cuprate directory string and return.
|
||||
$(#[$attr])*
|
||||
pub fn $fn() -> &'static Path {
|
||||
$once_lock.get_or_init(|| {
|
||||
/// Local `OnceLock` containing the Path.
|
||||
static ONCE_LOCK: OnceLock<PathBuf> = OnceLock::new();
|
||||
|
||||
ONCE_LOCK.get_or_init(|| {
|
||||
// There's nothing we can do but panic if
|
||||
// we cannot acquire critical system directories.
|
||||
//
|
||||
|
@ -139,7 +138,6 @@ impl_path_oncelock_and_fn! {
|
|||
/// | Linux | `/home/alice/.cache/cuprate/` |
|
||||
cuprate_cache_dir,
|
||||
cache_dir,
|
||||
__CUPRATE_CACHE_DIR,
|
||||
"",
|
||||
|
||||
/// Cuprate's config directory.
|
||||
|
@ -153,7 +151,6 @@ impl_path_oncelock_and_fn! {
|
|||
/// | Linux | `/home/alice/.config/cuprate/` |
|
||||
cuprate_config_dir,
|
||||
config_dir,
|
||||
__CUPRATE_CONFIG_DIR,
|
||||
"",
|
||||
|
||||
/// Cuprate's data directory.
|
||||
|
@ -167,7 +164,6 @@ impl_path_oncelock_and_fn! {
|
|||
/// | Linux | `/home/alice/.local/share/cuprate/` |
|
||||
cuprate_data_dir,
|
||||
data_dir,
|
||||
__CUPRATE_DATA_DIR,
|
||||
"",
|
||||
|
||||
/// Cuprate's database directory.
|
||||
|
@ -181,7 +177,6 @@ impl_path_oncelock_and_fn! {
|
|||
/// | Linux | `/home/alice/.local/share/cuprate/database/` |
|
||||
cuprate_database_dir,
|
||||
data_dir,
|
||||
__CUPRATE_DATABASE_DIR,
|
||||
"database",
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
MIT license
|
||||
|
||||
Copyright (C) 2023 Cuprate Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,9 +0,0 @@
|
|||
MIT license
|
||||
|
||||
Copyright (C) 2023 Cuprate Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Loading…
Reference in a new issue