Skip to content

Commit

Permalink
chore: use publicly available momento crate and remove client-sdk-rus…
Browse files Browse the repository at this point in the history
…t submodule (#103)
  • Loading branch information
poppoerika authored Apr 11, 2022
1 parent a22aaec commit f36a71c
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 47 deletions.
20 changes: 5 additions & 15 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PRIVATE_REPO_RELEASE_ACCESS }}
- name: rustfmt
run: cargo fmt -- --check

Expand All @@ -28,9 +25,6 @@ jobs:
version: ${{ steps.release.outputs.release }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PRIVATE_REPO_RELEASE_ACCESS }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -49,7 +43,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
allow-initial-development-versions: true
force-bump-patch-version: true

- name: Update Cargo Version
run: |
chmod +x set_cargo_version.sh
Expand All @@ -66,7 +60,7 @@ jobs:
ARCHIVE_FILE=archive-$VERSION.tar.gz
echo "ARCHIVE_FILE="$ARCHIVE_FILE >> $GITHUB_ENV
pip install git-archive-all
git-archive-all --force-submodules $ARCHIVE_FILE
git-archive-all $ARCHIVE_FILE
SHA=$(openssl sha256 < ${ARCHIVE_FILE} | sed 's/.* //')
echo "SHA="$SHA >> $GITHUB_ENV
echo "sha is: ${SHA}"
Expand Down Expand Up @@ -98,20 +92,17 @@ jobs:
git add .
git commit -m "momento-cli ${{ steps.semrel.outputs.version }}"
git push origin formula/momento-cli/v${{ steps.semrel.outputs.version }}
- name: Output release
id: release
run: echo "::set-output name=release::${{ steps.semrel.outputs.version }}"

update-cargo:
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PRIVATE_REPO_RELEASE_ACCESS }}


- name: Update Cargo Version
run: |
chmod +x set_cargo_version.sh
Expand All @@ -136,4 +127,3 @@ jobs:
fi
echo ${PR_URL}
shell: bash

8 changes: 0 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# this is temporary until we publish the rust sdk
submodules: true
token: ${{ secrets.PRIVATE_REPO_RELEASE_ACCESS }}
- name: rustfmt
run: cargo fmt -- --check
- name: Rigorous lint via Clippy
Expand All @@ -32,10 +28,6 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
# 🤮
submodules: true
token: ${{ secrets.PRIVATE_REPO_RELEASE_ACCESS }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand Down
8 changes: 0 additions & 8 deletions CONTRIBUTING.ja.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
### 開始方法

```
git submodule init
git submodule sync
git submodule update --recursive --remote
```

## ビルド

```
Expand Down
8 changes: 0 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
### Starting Off

```
git submodule init
git submodule sync
git submodule update --recursive --remote
```

### Building

```
Expand Down
4 changes: 3 additions & 1 deletion Cargo.lock

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

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ toml = "0.5.8"
maplit = "1.0.2"
configparser = "3.0.0"
regex = "1"
momento = "0.1.3"

[dev-dependencies]
assert_cmd = "2.0.2"
Expand Down Expand Up @@ -47,6 +48,3 @@ version = "1.0.79"
version = "0.11"
features = [ "json", "rustls-tls",]
default-features = false

[dependencies.momento]
path = "./client-sdk-rust"
1 change: 0 additions & 1 deletion client-sdk-rust
Submodule client-sdk-rust deleted from 76b0a2
10 changes: 8 additions & 2 deletions src/commands/cache/cache_cli.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use log::{debug, info};
use momento::simple_cache_client::SimpleCacheClient;
use std::num::NonZeroU64;

use crate::error::CliError;

async fn get_momento_instance(auth_token: String) -> Result<SimpleCacheClient, CliError> {
match SimpleCacheClient::new(auth_token, 100).await {
match SimpleCacheClient::new(auth_token, NonZeroU64::new(100).unwrap()).await {
Ok(m) => Ok(m),
Err(e) => Err(CliError { msg: e.to_string() }),
}
Expand Down Expand Up @@ -54,7 +55,12 @@ pub async fn set(
debug!("setting key: {} into cache: {}", key, cache_name);
let mut momento = get_momento_instance(auth_token).await?;
match momento
.set(&cache_name, key, value, Some(ttl_seconds))
.set(
&cache_name,
key,
value,
Some(NonZeroU64::new(ttl_seconds).unwrap()),
)
.await
{
Ok(_) => debug!("set success"),
Expand Down
3 changes: 2 additions & 1 deletion src/commands/signingkey/signingkey_cli.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use log::debug;
use momento::simple_cache_client::SimpleCacheClient;
use std::num::NonZeroU64;

use crate::error::CliError;

async fn get_momento_instance(auth_token: String) -> Result<SimpleCacheClient, CliError> {
match SimpleCacheClient::new(auth_token, 100).await {
match SimpleCacheClient::new(auth_token, NonZeroU64::new(100).unwrap()).await {
Ok(m) => Ok(m),
Err(e) => Err(CliError { msg: e.to_string() }),
}
Expand Down

0 comments on commit f36a71c

Please sign in to comment.