mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
* mount: read SSE-S3 objects through an authenticated S3 gateway * mount: check each comma-joined mount option against -sseS3ReadEndpoint Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: read a mounted version file by its object key and version id Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: read a current null-version object without s3:GetObjectVersion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: declare -sseS3ReadEndpoint with the other mount options so weed fuse accepts it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: require the canonical bucket path as the root of an SSE-S3 read mount Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: fall back to the null version when the current object is another version Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: list the S3 endpoint each S3 gateway advertises Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: advertise the gateway's S3 endpoint to the master Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: find the S3 gateway through the masters instead of -sseS3ReadEndpoint -sseS3Read turns gateway reads on. The reader lists the S3 endpoints the filer's masters have registered, prefers HTTPS, and picks another gateway when the current one cannot be reached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: retry an unreachable S3 gateway read on a different gateway Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: warn when -sseS3Read falls back to a plain-HTTP gateway Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: do not retry an unreachable HTTPS gateway over plain HTTP Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: tell HTTPS gateways apart by the parsed URL scheme An S3 gateway advertised as HTTPS://host lost the HTTPS preference and the plain-HTTP fallback guard, since the check matched the raw string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
1.8 KiB
Go
75 lines
1.8 KiB
Go
package mount
|
|
|
|
import (
|
|
"slices"
|
|
"sync"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
|
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
|
|
)
|
|
|
|
type LockedEntry struct {
|
|
*filer_pb.Entry
|
|
sync.RWMutex
|
|
sseS3Check sync.Once
|
|
sseS3 bool
|
|
}
|
|
|
|
// Native reads cannot decrypt S3 objects. Check the entry once per metadata
|
|
// change so reads of ordinary files do not repeatedly scan their chunk list.
|
|
func (le *LockedEntry) hasSSES3Data() bool {
|
|
le.RLock()
|
|
defer le.RUnlock()
|
|
return le.hasSSES3DataLocked()
|
|
}
|
|
|
|
func (le *LockedEntry) hasSSES3DataLocked() bool {
|
|
le.sseS3Check.Do(func() {
|
|
metadata := le.Entry.GetExtended()
|
|
_, hasKey := metadata[s3_constants.SeaweedFSSSES3Key]
|
|
le.sseS3 = hasKey && string(metadata[s3_constants.AmzServerSideEncryption]) == s3_constants.SSEAlgorithmAES256
|
|
if !le.sseS3 {
|
|
le.sseS3 = slices.ContainsFunc(le.Entry.GetChunks(), func(chunk *filer_pb.FileChunk) bool {
|
|
return chunk.GetSseType() == filer_pb.SSEType_SSE_S3
|
|
})
|
|
}
|
|
})
|
|
return le.sseS3
|
|
}
|
|
|
|
func (le *LockedEntry) GetEntry() *filer_pb.Entry {
|
|
le.RLock()
|
|
defer le.RUnlock()
|
|
return le.Entry
|
|
}
|
|
|
|
// SetEntry sets the entry of the LockedEntry
|
|
// entry should never be nil
|
|
func (le *LockedEntry) SetEntry(entry *filer_pb.Entry) {
|
|
le.Lock()
|
|
defer le.Unlock()
|
|
le.Entry = entry
|
|
le.sseS3Check = sync.Once{}
|
|
}
|
|
|
|
func (le *LockedEntry) UpdateEntry(fn func(entry *filer_pb.Entry)) *filer_pb.Entry {
|
|
le.Lock()
|
|
defer le.Unlock()
|
|
fn(le.Entry)
|
|
le.sseS3Check = sync.Once{}
|
|
return le.Entry
|
|
}
|
|
|
|
func (le *LockedEntry) GetChunks() []*filer_pb.FileChunk {
|
|
le.RLock()
|
|
defer le.RUnlock()
|
|
return le.Entry.Chunks
|
|
}
|
|
|
|
func (le *LockedEntry) AppendChunks(newChunks []*filer_pb.FileChunk) {
|
|
le.Lock()
|
|
defer le.Unlock()
|
|
le.Entry.Chunks = append(le.Entry.Chunks, newChunks...)
|
|
le.sseS3Check = sync.Once{}
|
|
}
|