Xuanwo commented on code in PR #5591: URL: https://github.com/apache/opendal/pull/5591#discussion_r1948449140
########## licenserc.toml: ########## @@ -43,4 +43,7 @@ excludes = [ # Test files "**/tests/data/**", "**/fixtures/data/**", + # dart binding generated file + "opendal_api.dart", Review Comment: How about adding `bindings/dart/` before? ########## bindings/dart/pubspec.yaml: ########## @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +name: opendal_dart Review Comment: Please just name as `opendal`. ########## bindings/dart/lib/src/rust/api/opendal_api.dart: ########## @@ -0,0 +1,176 @@ +// This file is automatically generated, so please do not edit it. +// @generated by `flutter_rust_bridge`@ 2.7.1. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; + +// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<Capability>> +abstract class Capability implements RustOpaqueInterface { Review Comment: Please don't expose the capability unless we decide to support it. ########## bindings/dart/pubspec.yaml: ########## @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +name: opendal_dart +description: opendal dart binding Review Comment: Please make it clear that opendal is an apache project, like Apache OpenDALâ„¢ Dart Binding. ########## bindings/dart/lib/src/rust/api/opendal_api.dart: ########## @@ -0,0 +1,176 @@ +// This file is automatically generated, so please do not edit it. +// @generated by `flutter_rust_bridge`@ 2.7.1. + +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import + +import '../frb_generated.dart'; +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; + +// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<Capability>> +abstract class Capability implements RustOpaqueInterface { + /// If operator supports blocking. + bool get blocking; + + /// If operator supports copy. + bool get copy; + + /// If operator supports create dir. + bool get createDir; + + /// If operator supports delete. + bool get delete; + + /// If operator supports list. + bool get list; + + /// If backend supports list with limit. + bool get listWithLimit; + + /// If backend supports list with recursive. + bool get listWithRecursive; + + /// If backend supports list with start after. + bool get listWithStartAfter; + + /// If operator supports presign. + bool get presign; + + /// If operator supports presign read. + bool get presignRead; + + /// If operator supports presign stat. + bool get presignStat; + + /// If operator supports presign write. + bool get presignWrite; + + /// If operator supports read. + bool get read; + + /// If operator supports read with if matched. + bool get readWithIfMatch; + + /// If operator supports read with if not match. + bool get readWithIfNoneMatch; + + /// if operator supports read with override cache control. + bool get readWithOverrideCacheControl; + + /// if operator supports `read` with override content disposition. + bool get readWithOverrideContentDisposition; + + /// if operator supports read with override content type. + bool get readWithOverrideContentType; + + /// If operator supports rename. + bool get rename; + + /// If operator supports shared. + bool get shared; + + /// If operator supports stat. + bool get stat; + + /// If operator supports stat with if matched. + bool get statWithIfMatch; + + /// If operator supports stat with if not match. + bool get statWithIfNoneMatch; + + /// If operator supports write. + bool get write; + + /// If operator supports write by append. + bool get writeCanAppend; + + /// If operator supports write with empty content. + bool get writeCanEmpty; + + /// If operator supports write can be called in multi times. + bool get writeCanMulti; + + /// write_multi_max_size is the max size that services support in write_multi. + /// + /// For example, AWS S3 supports 5GiB as max in write_multi. + BigInt? get writeMultiMaxSize; + + /// write_multi_min_size is the min size that services support in write_multi. + /// + /// For example, AWS S3 requires at least 5MiB in write_multi expect the last one. + BigInt? get writeMultiMinSize; + + /// write_total_max_size is the max size that services support in write_total. + /// + /// For example, Cloudflare D1 supports 1MB as max in write_total. + BigInt? get writeTotalMaxSize; + + /// If operator supports write with cache control. + bool get writeWithCacheControl; + + /// If operator supports write with content disposition. + bool get writeWithContentDisposition; + + /// If operator supports write with content type. + bool get writeWithContentType; +} + +// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<Metadata>> +abstract class Metadata implements RustOpaqueInterface { + /// Content-Disposition of this object + String? get contentDisposition; + + /// Content Length of this object + BigInt? get contentLength; + + /// Content MD5 of this object. + String? get contentMd5; + + /// Content Type of this object. + String? get contentType; + + /// ETag of this object. + String? get etag; + + /// Returns true if the <op.stat> object describes a file system directory. + bool get isDirectory; + + /// Returns true if the <op.stat> object describes a regular file. + bool get isFile; + + /// Last Modified of this object. + /// + /// We will output this time in RFC3339 format like `1996-12-19T16:39:57+08:00`. + String? get lastModified; +} + +// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<Operator>> +abstract class Operator implements RustOpaqueInterface { + Capability capability(); + + Future<void> check(); + + Future<void> createDir({required String path}); + + void createDirSync({required String path}); + + Future<void> delete({required String path}); + + void deleteSync({required String path}); + + Future<bool> isExist({required String path}); + + bool isExistSync({required String path}); + + factory Operator( + {required String schemeStr, required Map<String, String> map}) => + RustLib.instance.api + .crateApiOpendalApiOperatorNew(schemeStr: schemeStr, map: map); + + Future<void> rename({required String from, required String to}); + + void renameSync({required String from, required String to}); + + Future<Metadata> stat({required String path}); + + Metadata statSync({required String path}); +} Review Comment: I noticed that we are following the same way of rust's API. Does dart use this same API pattern? Maybe we can take it's fs API or s3 SDK for an example. ########## bindings/dart/rust/src/lib.rs: ########## @@ -0,0 +1,19 @@ +mod frb_generated; /* AUTO INJECTED BY flutter_rust_bridge. This line may not be accurate, and you can change it according to your needs. */ Review Comment: Can we move this line? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
