diff --git a/src/main.zig b/src/main.zig index 8aa5553..7ccbee0 100644 --- a/src/main.zig +++ b/src/main.zig @@ -236,9 +236,13 @@ pub fn main() anyerror!void { std.log.info("key group quantity: {d}", .{list.quantity}); }, .rest_xml_work_with_s3 => { + // TODO: This test makes the compiler try to create a monomorphic function + // that frees both a bool and an i64 + std.log.err("This demo (rest_xml_work_with_s3) is not yet fully functional in 0.11", .{}); const key = "i/am/a/teapot/foo"; - // const key = "foo"; - + _ = key; + // // const key = "foo"; + // const bucket = blk: { const result = try client.call(services.s3.list_buckets.Request{}, options); defer result.deinit(); @@ -259,43 +263,48 @@ pub fn main() anyerror!void { break :blk try allocator.dupe(u8, location); }; defer allocator.free(location); + const s3opts = aws.Options{ .region = location, .client = client, }; - { - const result = try aws.Request(services.s3.put_object).call(.{ - .bucket = bucket, - .key = key, - .content_type = "text/plain", - .body = "bar", - .storage_class = "STANDARD", - }, s3opts); - std.log.info("PutObject Request id: {any}", .{result.response_metadata.request_id}); - std.log.info("PutObject etag: {any}", .{result.response.e_tag.?}); - defer result.deinit(); - } - { - // Note that boto appears to redirect by default, but java - // does not. We will not - const result = try aws.Request(services.s3.get_object).call(.{ - .bucket = bucket, - .key = key, - }, s3opts); - std.log.info("GetObject Request id: {any}", .{result.response_metadata.request_id}); - std.log.info("GetObject Body: {any}", .{result.response.body}); - std.log.info("GetObject etag: {any}", .{result.response.e_tag.?}); - std.log.info("GetObject last modified (seconds since epoch): {d}", .{result.response.last_modified.?}); - defer result.deinit(); - } - { - const result = try aws.Request(services.s3.delete_object).call(.{ - .bucket = bucket, - .key = key, - }, s3opts); - std.log.info("DeleteObject Request id: {any}", .{result.response_metadata.request_id}); - defer result.deinit(); - } + // TODO: This block triggers the free(bool) problem. Note that the rest of this will have runtime issues + // without the block + // { + // const result = try aws.Request(services.s3.put_object).call(.{ + // .bucket = bucket, + // .key = key, + // .content_type = "text/plain", + // .body = "bar", + // .storage_class = "STANDARD", + // }, s3opts); + // std.log.info("PutObject Request id: {any}", .{result.response_metadata.request_id}); + // std.log.info("PutObject etag: {any}", .{result.response.e_tag.?}); + // defer result.deinit(); + // } + // TODO: This block triggers both compile errors + // { + // // Note that boto appears to redirect by default, but java + // // does not. We will not + // const result = try aws.Request(services.s3.get_object).call(.{ + // .bucket = bucket, + // .key = key, + // }, s3opts); + // std.log.info("GetObject Request id: {any}", .{result.response_metadata.request_id}); + // std.log.info("GetObject Body: {any}", .{result.response.body}); + // std.log.info("GetObject etag: {any}", .{result.response.e_tag.?}); + // std.log.info("GetObject last modified (seconds since epoch): {d}", .{result.response.last_modified.?}); + // defer result.deinit(); + // } + // TODO: This block triggers the free(bool) problem. Note that the rest of this will have runtime issues + // { + // const result = try aws.Request(services.s3.delete_object).call(.{ + // .bucket = bucket, + // .key = key, + // }, s3opts); + // std.log.info("DeleteObject Request id: {any}", .{result.response_metadata.request_id}); + // defer result.deinit(); + // } { const result = try aws.Request(services.s3.list_objects).call(.{ .bucket = bucket,