Documentation
¶
Overview ¶
Package core internal/core/executor.go
Package core internal/core/health.go
Package core internal/core/request.go
Package core internal/core/response.go
Index ¶
- type Executor
- func (e *Executor) Execute(ctx context.Context, req *Request) (*http.Response, error)
- func (e *Executor) GetCredentials(ctx context.Context) (credentials.Value, error)
- func (e *Executor) HealthCheck(opts *HealthCheckOptions) *HealthCheckResult
- func (e *Executor) HealthCheckWithRetry(opts *HealthCheckOptions, maxRetries int) *HealthCheckResult
- func (e *Executor) Presign(ctx context.Context, req *Request) (*url.URL, http.Header, error)
- func (e *Executor) ResolveBucketLocation(ctx context.Context, bucketName string) (string, error)
- func (e *Executor) TargetURL(ctx context.Context, bucketName, objectName string, query url.Values) (*url.URL, error)
- type ExecutorConfig
- type HealthCheckOptions
- type HealthCheckResult
- type LocationCache
- type Request
- type RequestMetadata
- type ResponseParser
- func (p *ResponseParser) ParseError(resp *http.Response, bucketName, objectName string) error
- func (p *ResponseParser) ParseObjectInfo(resp *http.Response, bucketName, objectName string) (types.ObjectInfo, error)
- func (p *ResponseParser) ParseUploadInfo(resp *http.Response, bucketName, objectName string) (types.UploadInfo, error)
- func (p *ResponseParser) ParseXML(resp *http.Response, v interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor executes HTTP requests against RustFS/S3 endpoints
func NewExecutor ¶
func NewExecutor(config ExecutorConfig) *Executor
NewExecutor creates a new Executor
func (*Executor) GetCredentials ¶ added in v1.0.5
GetCredentials returns the resolved credentials using the executor context.
func (*Executor) HealthCheck ¶
func (e *Executor) HealthCheck(opts *HealthCheckOptions) *HealthCheckResult
HealthCheck performs health check Sends a simple HEAD request to the endpoint to verify connectivity
func (*Executor) HealthCheckWithRetry ¶
func (e *Executor) HealthCheckWithRetry(opts *HealthCheckOptions, maxRetries int) *HealthCheckResult
HealthCheckWithRetry performs health check with retries
func (*Executor) Presign ¶ added in v1.0.3
Presign builds and signs the request, returning the presigned URL and signed headers without executing it.
func (*Executor) ResolveBucketLocation ¶ added in v1.0.5
ResolveBucketLocation fetches the bucket location and updates the cache.
type ExecutorConfig ¶
type ExecutorConfig struct {
HTTPClient *http.Client
EndpointURL *url.URL
Credentials *credentials.Credentials
Region string
Secure bool
BucketLookup int
MaxRetries int
LocationCache LocationCache
}
ExecutorConfig configures an Executor
type HealthCheckOptions ¶
type HealthCheckOptions struct {
// Timeout (default 5 seconds)
Timeout time.Duration
// Optional bucket name for check (default none)
BucketName string
// Context
Context context.Context
}
HealthCheckOptions health check options
type HealthCheckResult ¶
type HealthCheckResult struct {
// Whether healthy
Healthy bool
// Error detail
Error error
// Response time
ResponseTime time.Duration
// HTTP status code
StatusCode int
// Checked time
CheckedAt time.Time
// Endpoint
Endpoint string
// Region
Region string
}
HealthCheckResult holds health check result
func (*HealthCheckResult) String ¶
func (r *HealthCheckResult) String() string
String returns formatted health check result
type LocationCache ¶
type LocationCache interface {
Get(bucketName string) (string, bool)
Set(bucketName, location string)
Delete(bucketName string)
}
LocationCache caches bucket locations
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request encapsulated HTTP request
func NewRequest ¶
func NewRequest(ctx context.Context, method string, metadata RequestMetadata) *Request
NewRequest creates a new Request
func (*Request) Metadata ¶
func (r *Request) Metadata() RequestMetadata
Metadata returns request metadata
type RequestMetadata ¶
type RequestMetadata struct {
// Bucket and object
BucketName string
ObjectName string
// Query parameters
QueryValues url.Values
// Request headers
CustomHeader http.Header
// Request body
ContentBody io.Reader
ContentLength int64
// Content validation
ContentMD5Base64 string
ContentSHA256Hex string
// Signing options
StreamSHA256 bool
PresignURL bool
Expires int64
// Extra headers for presign
ExtraPresignHeader http.Header
// Location
BucketLocation string
// Trailer (for streaming signature)
Trailer http.Header
AddCRC bool
// Special handling
Expect200OKWithError bool
}
RequestMetadata holds request metadata
type ResponseParser ¶
type ResponseParser struct{}
ResponseParser parses HTTP responses
func NewResponseParser ¶
func NewResponseParser() *ResponseParser
NewResponseParser creates a ResponseParser
func (*ResponseParser) ParseError ¶
func (p *ResponseParser) ParseError(resp *http.Response, bucketName, objectName string) error
ParseError parses error response
func (*ResponseParser) ParseObjectInfo ¶
func (p *ResponseParser) ParseObjectInfo(resp *http.Response, bucketName, objectName string) (types.ObjectInfo, error)
ParseObjectInfo parses object info from response headers
func (*ResponseParser) ParseUploadInfo ¶
func (p *ResponseParser) ParseUploadInfo(resp *http.Response, bucketName, objectName string) (types.UploadInfo, error)
ParseUploadInfo parses upload info from response