Skip to content

Commit

Permalink
file comparators too
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryTravis committed Dec 20, 2024
1 parent cbb9fa7 commit f584add
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ type S3_File
S3_File.Value (S3_Path.Value bucket key) self.credentials
files = pair.second . map key->
S3_File.Value (S3_Path.Value bucket key) self.credentials
(sub_folders + files) . sort on=(x-> x.s3_path)
(sub_folders + files) . sort

## ALIAS load bytes, open bytes
ICON data_input
Expand Down Expand Up @@ -616,3 +616,11 @@ translate_file_errors related_file result =
s3_path = S3_Path.Value error.bucket error.key
s3_file = S3_File.Value s3_path related_file.credentials
Error.throw (File_Error.Not_Found s3_file)

type S3_File_Comparator
compare x y = Ordering.compare x.s3_path y.s3_path

hash x = S3_File_Comparator.hash_builtin x
hash_builtin x = @Builtin_Method "Default_Comparator.hash_builtin"

Comparable.from that:S3_File = Comparable.new that S3_File_Comparator
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ type Enso_File
file = Enso_File.Value (self.enso_path.resolve asset.name)
Asset_Cache.update file asset
file
results.sort on=.enso_path
results.sort

## GROUP Output
ICON folder_add
Expand Down Expand Up @@ -584,3 +584,11 @@ File_Like.from (that : Enso_File) = File_Like.Value that
## PRIVATE
Writable_File.from (that : Enso_File) = if Data_Link.is_data_link that then Data_Link_Helpers.interpret_data_link_as_writable_file that else
Writable_File.Value that Enso_File_Write_Strategy.instance

type Enso_File_Comparator
compare x y = Ordering.compare x.enso_path y.enso_path

hash x = Enso_File_Comparator.hash_builtin x
hash_builtin x = @Builtin_Method "Default_Comparator.hash_builtin"

Comparable.from that:Enso_File = Comparable.new that Enso_File_Comparator

0 comments on commit f584add

Please sign in to comment.