Skip to content

Commit 88e15c6

Browse files
committed
README: update MSRV, fix install command, use client.py
1 parent 6bc45e4 commit 88e15c6

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

README.md

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ with a JSON payload of the form:
7979

8080
The currently supported reducers are `max`, `min`, `mean`, `sum`, `select` and `count`. All reducers return the result using the same datatype as specified in the request except for `count` which always returns the result as `int64`.
8181

82+
The proxy adds two custom headers `x-activestorage-dtype` and `x-activestrorage-shape` to the HTTP response to allow the numeric result to be reconstructed from the binary content of the response.
83+
8284
[//]: <> (TODO: No OpenAPI support yet).
8385
[//]: <> (For a running instance of the proxy server, the full OpenAPI specification is browsable as a web page at the `{proxy-address}/redoc/` endpoint or in raw JSON form at `{proxy-address}/openapi.json`.)
8486

@@ -97,7 +99,7 @@ In particular, the following are known limitations which we intend to address:
9799
### Prerequisites
98100

99101
This project is written in Rust, and as such requires a Rust toolchain to be installed in order to build it.
100-
The Minimum Supported Rust Version (MSRV) is 1.62.1, due to a dependency on the [AWS SDK](https://github.com/awslabs/aws-sdk-rust).
102+
The Minimum Supported Rust Version (MSRV) is 1.66.1, due to a dependency on the [AWS SDK](https://github.com/awslabs/aws-sdk-rust).
101103
It may be necessary to use [rustup](https://rustup.rs/) rather than the OS provided Rust toolchain to meet this requirement.
102104
See the [Rust book](https://doc.rust-lang.org/book/ch01-01-installation.html) for toolchain installation.
103105

@@ -125,7 +127,7 @@ cargo run --release
125127
Or installed to the system:
126128

127129
```sh
128-
cargo install
130+
cargo install --path . --locked
129131
```
130132

131133
Then run:
@@ -161,7 +163,7 @@ In a separate terminal, set up the Python virtualenv then upload some sample dat
161163

162164
```sh
163165
# Create a virtualenv
164-
python -m venv ./venv
166+
python3 -m venv ./venv
165167
# Activate the virtualenv
166168
source ./venv/bin/activate
167169
# Install dependencies
@@ -178,33 +180,22 @@ Proxy functionality can be tested using the [S3 active storage compliance suite]
178180

179181
Request authentication is implemented using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication) with the username and password consisting of your S3 Access Key ID and Secret Access Key, respectively. These credentials are then used internally to authenticate with the upstream S3 source using [standard AWS authentication methods](https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-auth-using-authorization-header.html)
180182

181-
A request to an active storage proxy running on localhost with Minio as the S3 source is as simple as:
183+
A basic Python client is provided in `scripts/client.py`.
184+
First install dependencies in a Python virtual environment:
182185

183-
```python
184-
import json
185-
import numpy as np
186-
import requests
187-
188-
request_data = {
189-
'source': 'http://localhost:9000',
190-
'bucket': 'sample-data',
191-
'object': 'data-float32.dat',
192-
'dtype': 'float32',
193-
# All other fields assume their default values
194-
}
195-
196-
reducer = 'sum'
197-
response = requests.post(
198-
f'http://localhost:8000/v1/{reducer}',
199-
json=request_data,
200-
auth=('minioadmin', 'minioadmin')
201-
)
202-
shape = json.loads(response.headers['x-activestorage-shape'])
203-
sum_result = np.frombuffer(response.content, dtype=response.headers['x-activestorage-dtype'])
204-
sum_result = sum_result.reshape(shape)
186+
```sh
187+
# Create a virtualenv
188+
python3 -m venv ./venv
189+
# Activate the virtualenv
190+
source ./venv/bin/activate
191+
# Install dependencies
192+
pip install scripts/requirements.txt
205193
```
206194

207-
The proxy adds two custom headers `x-activestorage-dtype` and `x-activestrorage-shape` to the HTTP response to allow the numeric result to be reconstructed from the binary content of the response.
195+
Then use the client to make a request:
196+
```sh
197+
venv/bin/python ./scripts/client.py sum --server http://localhost:8080 --source http://localhost:9000 --username minioadmin --password minioadmin --bucket sample-data --object data-uint32.dat --dtype uint32
198+
```
208199

209200
---
210201

scripts/upload_sample_data.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def n_bytes(self):
2424
S3_URL = 'http://localhost:9000'
2525

2626
s3_fs = s3fs.S3FileSystem(key='minioadmin', secret='minioadmin', client_kwargs={'endpoint_url': S3_URL})
27-
data_dir = pathlib.Path('./testdata')
2827
bucket = pathlib.Path('sample-data')
2928

3029
#Make sure s3 bucket exists

0 commit comments

Comments
 (0)