File: s3_list_parts.h

package info (click to toggle)
aws-crt-python 0.16.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,328 kB
  • sloc: ansic: 330,743; python: 18,949; makefile: 6,271; sh: 3,712; asm: 754; cpp: 699; ruby: 208; java: 77; perl: 73; javascript: 46; xml: 11
file content (124 lines) | stat: -rw-r--r-- 3,664 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#ifndef AWS_S3_LIST_PARTS_H
#define AWS_S3_LIST_PARTS_H

/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#include <aws/s3/private/s3_paginator.h>
#include <aws/s3/s3_client.h>

#include <aws/common/date_time.h>
#include <aws/common/string.h>

/** Struct representing part info as returned from ListParts call. */
struct aws_s3_part_info {
    /**
     * Size of the object in bytes.
     */
    uint64_t size;
    /**
     * Part number of the given part.
     */
    uint32_t part_number;
    /**
     * Timestamp from S3 on the latest modification, if you have a reliable clock on your machine, you COULD use this
     * to implement caching.
     */
    struct aws_date_time last_modified;
    /**
     * Etag for the object, usually an MD5 hash. you COULD also use this to implement caching.
     */
    struct aws_byte_cursor e_tag;

    /**
     * CRC32 checksum for the part. Optional.
     */
    struct aws_byte_cursor checksumCRC32;

    /**
     * CRC32C checksum for the part. Optional.
     */
    struct aws_byte_cursor checksumCRC32C;

    /**
     * SHA1 checksum for the part. Optional.
     */
    struct aws_byte_cursor checksumSHA1;

    /**
     * SHA256 checksum for the part. Optional.
     */
    struct aws_byte_cursor checksumSHA256;
};

/**
 * Invoked when a part is encountered during ListParts call. Return false, to immediately
 * terminate the list operation. Returning true will continue until at least the current page is iterated.
 */
typedef bool(aws_s3_on_part_fn)(const struct aws_s3_part_info *info, void *user_data);

/**
 * Parameters for calling aws_s3_initiate_list_parts(). All values are copied out or re-seated and reference counted.
 */
struct aws_s3_list_parts_params {
    /**
     * Must not be NULL. The internal call will increment the reference count on client.
     */
    struct aws_s3_client *client;
    /**
     * Must not be empty. Name of the bucket to list.
     */
    struct aws_byte_cursor bucket_name;
    /**
     * Must not be empty. Key with which multipart upload was initiated.
     */
    struct aws_byte_cursor key;
    /**
     * Must not be empty. Id identifying multipart upload.
     */
    struct aws_byte_cursor upload_id;
    /**
     * Must not be empty. The endpoint for the S3 bucket to hit. Can be virtual or path style.
     */
    struct aws_byte_cursor endpoint;
    /**
     * Callback to invoke on each part that's listed.
     */
    aws_s3_on_part_fn *on_part;
    /**
     * Callback to invoke when each page of the bucket listing completes.
     */
    aws_s3_on_page_finished_fn *on_list_finished;
    /**
     * Associated user data.
     */
    void *user_data;
};

AWS_EXTERN_C_BEGIN

/**
 * Initiates a list objects command (without executing it), and returns a paginator object to iterate the bucket with if
 * successful.
 *
 * Returns NULL on failure. Check aws_last_error() for details on the error that occurred.
 *
 * this is a reference counted object. It is returned with a reference count of 1. You must call
 * aws_s3_paginator_release() on this object when you are finished with it.
 *
 * This does not start the actual list operation. You need to call aws_s3_paginator_continue() to start
 * the operation.
 */
AWS_S3_API struct aws_s3_paginator *aws_s3_initiate_list_parts(
    struct aws_allocator *allocator,
    const struct aws_s3_list_parts_params *params);

AWS_S3_API struct aws_s3_paginated_operation *aws_s3_list_parts_operation_new(
    struct aws_allocator *allocator,
    const struct aws_s3_list_parts_params *params);

AWS_EXTERN_C_END

#endif /* AWS_S3_LIST_PARTS_H */