Skip to content

Commit

Permalink
Merge branch 'main' of github.com:bytebeamio/uplink into vilayat/task…
Browse files Browse the repository at this point in the history
…/graceful-shutdown
  • Loading branch information
Devdutt Shenoi committed Jan 4, 2024
2 parents cb4b564 + 2d1a69d commit 7688ad0
Show file tree
Hide file tree
Showing 14 changed files with 1,748 additions and 44 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ on:
types: [published]

jobs:
release-tools:
name: Build tools/${{ matrix.build }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build: [system-stats]
steps:
- uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-unknown-linux-musl

- name: Build binary
working-directory: tools/${{ matrix.build }}
run: cargo build --verbose --release

- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
files: tools/${{ matrix.build }}/target/release/${{ matrix.build }}

build-release:
name: Build release for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -105,6 +132,7 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: uplink*

build-release-android:
name: Build release for android
runs-on: ubuntu-latest
Expand Down
80 changes: 40 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
exclude = [
"tools/deserialize-backup",
"tools/simulator",
"tools/system-stats",
"tools/tunshell",
]

Expand Down
2 changes: 1 addition & 1 deletion simulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ download_auth_config() {
echo "Downloading config: $url"
mkdir -p devices
curl --location $url \
--header 'x-bytebeam-tenant: demo' \
--header "x-bytebeam-tenant: $BYTEBEAM_TENANT_ID" \
--header "x-bytebeam-api-key: $BYTEBEAM_API_KEY" > devices/device_$id.json
}

Expand Down
10 changes: 10 additions & 0 deletions storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pub enum Error {
NotBackup,
#[error("Corrupted backup file")]
CorruptedFile,
#[error("Empty write buffer")]
NoWrites,
}

pub struct Storage {
Expand Down Expand Up @@ -92,6 +94,14 @@ impl Storage {
return Ok(None);
}

self.flush()
}

/// Force flush the contents of write buffer onto disk
pub fn flush(&mut self) -> Result<Option<u64>, Error> {
if self.current_write_file.is_empty() {
return Err(Error::NoWrites);
}
match &mut self.persistence {
Some(persistence) => {
let NextFile { mut file, deleted } = persistence.open_next_write_file()?;
Expand Down
Loading

0 comments on commit 7688ad0

Please sign in to comment.