Skip to content

Commit 2664b8c

Browse files
authored
fix(storage): remove check for FinalizeOnClose (#11992)
We should ignore if FinalizeOnClose is set to true for non-Append Writers. The error may be confusing since regular writers will always finalize by default. Also, this should be easier to use for GCSFuse flows.
1 parent 6db35b1 commit 2664b8c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

storage/writer.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ type Writer struct {
115115
// yet available for general use.
116116
Append bool
117117

118-
// FinalizeOnClose indicates whether the writer should finalize an object when
118+
// FinalizeOnClose indicates whether the Writer should finalize an object when
119119
// closing the write stream. This only applies to Writers where Append is
120120
// true, since append semantics allow a prefix of the object to be durable and
121121
// readable. By default, objects written with Append semantics will not be
122-
// finalized, which means they can be appended to later.
122+
// finalized, which means they can be appended to later. If Append is set
123+
// to false, this parameter will be ignored; non-appendable objects will
124+
// always be finalized when Writer.Close returns without error.
123125
//
124-
// FinalizeOnClose is supported only on gRPC clients where [Writer.Append] is
125-
// set to true. This feature is in preview and is not yet available for
126-
// general use.
126+
// This feature is in preview and is not yet available for general use.
127127
FinalizeOnClose bool
128128

129129
// ProgressFunc can be used to monitor the progress of a large write
@@ -349,9 +349,6 @@ func (w *Writer) validateWriteAttrs() error {
349349
if w.ChunkSize < 0 {
350350
return errors.New("storage: Writer.ChunkSize must be non-negative")
351351
}
352-
if w.FinalizeOnClose && !w.Append {
353-
return errors.New("storage: Writer.FinalizeOnClose may only be true if Writer.Append is true")
354-
}
355352
return nil
356353
}
357354

0 commit comments

Comments
 (0)