Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFTPClientConfigInvalid = fmt.Errorf("client: config invalid, expected FTP")
View Source
var ErrSFTPClientConfigInvalid = fmt.Errorf("client: config invalid, expected SFTP")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // GetConnectionPool returns the connection pool representing the protocol. // // Parameters: // - logger: the logger used to log messages // // Returns: // - ConnectionPool: the connection pool // // Notice: only FTP and SFTP protocols are supported GetConnectionPool(logger logr.Logger) ConnectionPool // GetS3API returns the S3 API. // // Returns: // - S3API: the S3 API // // Notice: only S3 protocol is supported GetS3API() S3API // GetConnectionID returns the connection ID. // // Returns: // - string: the connection ID GetConnectionID() string // GetCredential returns the credential used to connect to the storage. // // Returns: // - any: the credential, it must be asserted to the correct type GetCredential() any }
Client represents the client used to connect to the storage.
type ConnectionPool ¶
type ConnectionPool interface { // InitializeIdleConnection caches the FTP connection with the given credential // into the connection // // Parameters: // - credential: the FTP credential that will be used to establish the connection // // Returns: // - err: the error if any occurred, nil otherwise InitializeIdleConnection(credential any) (err error) // GetFileSizeAndModTime retrieves the size and mod time of the file at the given path // // Parameters: // - ctx: the context // - filePath: the path of the file // // Returns: // - size: the size of the file // - modTime: the mod time of the file // - err: the error if any occurred, nil otherwise GetFileSizeAndModTime(ctx context.Context, filePath string) (size int64, modTime time.Time, err error) // RetrieveFileFromOffset retrieves the content of the file at the given path // starting from the given offset // // Parameters: // - ctx: the context // - filePath: the path of the file // - offset: the offset to start reading the file // - callback: the callback function that will be called with the reader // that contains the content of the file // // Returns: // - err: the error if any occurred, nil otherwise RetrieveFileFromOffset(ctx context.Context, filePath string, offset int64) (reader io.ReadCloser, err error) // MakeDirectoryAll creates a directory at the given path and all its parent directories // if they do not exist // // Parameters: // - ctx: the context // - connectionID: the ID of the connection used to establish the connection // - dirPath: the path of the directory // // Returns: // - err: the error if any occurred, nil otherwise occurred, nil otherwise MakeDirectoryAll(ctx context.Context, dirPath string) (err error) // CreateOrOverwriteFile stores the content of the reader to the file at the given path. // // Parameters: // - ctx: the context // - filePath: the path of the file // - reader: the reader that contains the content of the file // // Returns: // - err: the error if any occurred, nil otherwise CreateOrOverwriteFile(ctx context.Context, filePath string, reader io.Reader) (err error) // AppendToFile appends the content of the reader to the file at the given path. // // Parameters: // - ctx: the context // - filePath: the path of the file // - reader: the reader that contains the content of the file // // Returns: // - err: the error if any occurred, nil otherwise AppendToFile(ctx context.Context, filePath string, reader io.Reader, offset int64) (err error) // DeleteFile deletes the file at the given path // // Parameters: // - ctx: the context // - filePath: the path of the file // // Returns: // - err: the error if any occurred, nil otherwise occurred, nil otherwise DeleteFile(ctx context.Context, filePath string) (err error) // Close closes the connection gracefully Close() }
type S3API ¶
type S3API interface { PutObject(ctx context.Context, input *s3.PutObjectInput, opt ...func(*s3.Options)) (*s3.PutObjectOutput, error) ListParts(ctx context.Context, input *s3.ListPartsInput, opt ...func(*s3.Options)) (*s3.ListPartsOutput, error) UploadPart(ctx context.Context, input *s3.UploadPartInput, opt ...func(*s3.Options)) (*s3.UploadPartOutput, error) GetObject(ctx context.Context, input *s3.GetObjectInput, opt ...func(*s3.Options)) (*s3.GetObjectOutput, error) HeadObject(ctx context.Context, input *s3.HeadObjectInput, opt ...func(*s3.Options)) (*s3.HeadObjectOutput, error) CreateMultipartUpload(ctx context.Context, input *s3.CreateMultipartUploadInput, opt ...func(*s3.Options)) (*s3.CreateMultipartUploadOutput, error) AbortMultipartUpload(ctx context.Context, input *s3.AbortMultipartUploadInput, opt ...func(*s3.Options)) (*s3.AbortMultipartUploadOutput, error) DeleteObject(ctx context.Context, input *s3.DeleteObjectInput, opt ...func(*s3.Options)) (*s3.DeleteObjectOutput, error) DeleteObjects(ctx context.Context, input *s3.DeleteObjectsInput, opt ...func(*s3.Options)) (*s3.DeleteObjectsOutput, error) CompleteMultipartUpload(ctx context.Context, input *s3.CompleteMultipartUploadInput, opt ...func(*s3.Options)) (*s3.CompleteMultipartUploadOutput, error) UploadPartCopy(ctx context.Context, input *s3.UploadPartCopyInput, opt ...func(*s3.Options)) (*s3.UploadPartCopyOutput, error) }
Click to show internal directories.
Click to hide internal directories.