#snapshot #aws #amazon #ebs

awssnapio

实现 AWS 快照周围读写操作的库

1 个不稳定版本

0.1.0 2023年1月10日

#7 in #ebs

LGPL-3.0-only

55KB
1K SLoC

aws-snap-io

用于实现 AWS 快照的读写库。该库目前不提供异步读写实现,也没有在读取过程中使用并行方式读取多个块。可以使用稀疏缓存层,这样多个读取不会下载同一块多次。

支持的文件系统

操作系统 注意
Windows 缓存使用 DeviceIoControl::FSCTL_SET_SPARSE 和 FSCTL_SET_ZERO_DATA
Linux 仅使用 lseek(如果文件系统不支持稀疏,则缓存将不会是稀疏的。

使用 Coldsnap 通过并行方式复制整个快照。

read_snapshot

Test tool to read a number of bytes from a given offset in a snapshot. This requires that you have already setup your AWS credentials and region. This application is for testing and example only. Note this tool/lib does not support concurrent reads from a snapshot. Look at Coldsnap for that functionality

Usage: read_snapshot.exe [OPTIONS] --snapshot <SNAPSHOT> --offset <OFFSET> --length <LENGTH>

Options:
  -s, --snapshot <SNAPSHOT>  The name of the snapshot to read from
  -o, --offset <OFFSET>      The offset in the snapshot to start reading from
  -l, --length <LENGTH>      The length in bytes to read
      --logging <LOGGING>    The logging level to use [default: Info] [possible values: Off, Error, Warn, Info, Debug, Trace]
  -h, --help                 Print help information
  -V, --version              Print version information

示例

aws-snap-io$ ./target/release/examples/read_snapshot --snapshot snap-0acad277e952dfa05 --offset 330010624 --length 1091 | xxd -r -p
Files originating with or related to Casablanca v2.6.0, a "Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services." See https://github.com/Microsoft/cpprestsdk. This material is licensed under the terms of the Apache Software License v2.0 (see https://github.com/Microsoft/cpprestsdk/blob/master/license.txt), which state:

 ==++==

 Copyright (c) Microsoft Corporation. All rights reserved.
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

依赖项

~67–110MB
~1.5M SLoC