Documentation
¶
Index ¶
- Constants
- Variables
- func Read(l string, options ...ReaderOption) ([]byte, error)
- func Write(data []byte, l string, options ...WriterOption) error
- type Option
- type ReadHandler
- type Reader
- type ReaderOption
- type S3ClientFunc
- type S3ReadWriter
- type S3Reader
- type S3Writer
- type WriteHandler
- type Writer
- type WriterOption
Constants ¶
View Source
const ( AwsUsEast1 = "us-east-1" AwsUsWest1 = "us-west-1" AwsEuWest1 = "eu-west-1" AwsEuCentral1 = "eu-central-1" )
View Source
const ( HTTP = "http" HTTPS = "https" FILE = "file" S3 = "s3" )
Variables ¶
View Source
var ( ErrUnimplementedScheme = errors.New("monk: unimplemented scheme") ErrInvalidURL = errors.New("monk: invalid url") )
View Source
var ( // WithMethod returns an Option that sets // the method of a Reader or Writer to the given string. WithMethod = func(m string) Option { return func(r *configuration) { r.method = m } } // WithHeaders returns an Option that sets // the headers of a Reader or Writer to the given map. WithHeaders = func(h map[string]string) Option { return func(r *configuration) { r.headers = h } } // WithHttpClient returns an Option that sets // the http client of a Reader or Writer to the given http client. WithHttpClient = func(h *http.Client) Option { return func(r *configuration) { r.httpClient = h } } // WithS3ClientFunc returns an Option that sets // the s3 client generation function of a Reader or Writer. // // This function is called before every invocation to s3, // handling the connection pooling is upto the implementation. // // The default implementation uses the default configuration // to create the client and uses the same client for every call. WithS3ClientFunc = func(s3ClientFunc S3ClientFunc) Option { return func(r *configuration) { r.s3ClientFn = s3ClientFunc } } // WithContext returns a Option that configures a Reader or Writer // to carry out the read operation abiding to the provided context. // // For HTTP and s3 requests the context is used during request // and client initializations respectively. // // For filesystem reads if the context has a deadline the value // is used to set the ReadDeadline of a file, if the context has no // deadline, it is discarded. // // If unset context is context.Background() WithContext = func(ctx context.Context) Option { return func(r *configuration) { r.ctx = ctx } } )
Functions ¶
Types ¶
type Option ¶
type Option func(*configuration)
func (Option) ConfigureReader ¶
func (Option) ConfigureWriter ¶
type ReadHandler ¶
ReadHandler carries out a Read operation for a specific protocol, configuring itself based on the given Reader. Handlers attempt to take as much Reader options as possible into account when carrying out the operation but can ignore them if they are not applicable in the context of the protocol.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewReader ¶
func NewReader(l string, opts ...ReaderOption) *Reader
type ReaderOption ¶
type ReaderOption interface {
ConfigureReader(r *Reader)
}
type S3ClientFunc ¶
type S3ClientFunc func(ctx context.Context) (S3ReadWriter, error)
type S3ReadWriter ¶
type S3Reader ¶
type S3Reader interface { GetObject( ctx context.Context, input *s3.GetObjectInput, opts ...func(*s3.Options), ) (*s3.GetObjectOutput, error) }
type S3Writer ¶
type S3Writer interface { PutObject( ctx context.Context, input *s3.PutObjectInput, opts ...func(*s3.Options), ) (*s3.PutObjectOutput, error) }
type WriteHandler ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func NewWriter ¶
func NewWriter(l string, opts ...WriterOption) *Writer
type WriterOption ¶
type WriterOption interface {
ConfigureWriter(w *Writer)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.