Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Refine ExternalStorage interface. #107

@SunRunAway

Description

@SunRunAway

The interface ExternalStorage force us to save the entire file into memory when reading or writing.

// ExternalStorage represents a kind of file system storage
type ExternalStorage interface {
	// Write file to storage
	Write(ctx context.Context, name string, data []byte) error
	// Read storage file
	Read(ctx context.Context, name string) ([]byte, error)
	// FileExists return true if file exists
	FileExists(ctx context.Context, name string) (bool, error)
}

Suggest a new interface

// ExternalStorage represents a kind of file system storage
type ExternalStorage interface {
	// Write file to storage
	NewWriter(ctx context.Context, name string) (io.WriteCloser, error)
	// Read storage file
	NewReader(ctx context.Context, name string) (rc io.ReadCloser, size int64, err error)
	// FileExists return true if file exists
	FileExists(ctx context.Context, name string) (bool, error)
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions