Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) Dir(ctx context.Context, p string) (fs.DirIterator, error)
- func (c *Client) DirFrom(ctx context.Context, p string, lastName string) (fs.DirIterator, error)
- func (c *Client) Download(ctx context.Context, p string) (fs.Reader, error)
- func (c *Client) DownloadMetadata(ctx context.Context, p string) (*fs.Metadata, error)
- func (c *Client) Exists(ctx context.Context, p string) (bool, error)
- func (c *Client) FilerURL() string
- func (c *Client) IsDir(ctx context.Context, p string) (bool, error)
- func (c *Client) IsDirEmpty(ctx context.Context, p string) (bool, error)
- func (c *Client) IsFile(ctx context.Context, p string) (bool, error)
- func (c *Client) MasterURL() string
- func (c *Client) Mkdir(ctx context.Context, p string) error
- func (c *Client) Remove(ctx context.Context, p string) error
- func (c *Client) Rmdir(ctx context.Context, p string) error
- func (c *Client) Upload(ctx context.Context, p string) (fs.Writer, error)
- type ClientConfig
Constants ¶
const ( MaxChunkSize = 16 * 1024 * 1024 MaxChunkNameLength = math.MaxUint8 )
Constants used to determine when a chunk or collection of chunks is valid.
const ( DefaultMasterPort = 9333 DefaultFilerPort = 8888 DefaultHostname = "localhost" )
The default options values.
const ( ErrNilConfiguration = seaweedError(iota) ErrEmptyMasterHostname ErrInvalidMasterScheme ErrIllegalMasterPath ErrIllegalMasterURL ErrEmptyFilerHostname ErrInvalidFilerScheme ErrIllegalFilerPath ErrIllegalFilerURL ErrUninitialised ErrInvalidChunkName ErrChunkTooLarge )
The valid errors
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { log.BasicLogable // contains filtered or unexported fields }
Client represents the client view of a SeaweedFS file system
func New ¶
func New(ctx context.Context, cfg *ClientConfig) (*Client, error)
New returns a new client connection to the SeaweedFS server specified by the configuration cfg.
func (*Client) Dir ¶
Dir returns an iterator containing metadata for the files and directories within the directory with path p. If the path p does not exist then an fs/errors.NotExist error is returned; if the path p exists but is not a directory then an fs/errors.NotDirectory error will be returned. It is the caller's responsibility to call Close on the returned fs.DirIterator, otherwise resources may leak.
func (*Client) DirFrom ¶
DirFrom returns an iterator containing metadata for the files and directories within the directory with path p. If lastName is empty, the first entry in this iterator will be metadata for the first file or directory in p; otherwise the first entry in the iterator is metadata for the file or directory after lastName. File and directory names are ordered lexicographically. Note that lastName need not exist in p. Note also that lastName can be given as either an absolute path whose directory is p, or as a path relative to p whose directory is p. If the path p does not exist then an fs/errors.NotExist error is returned; if the path p exists but is not a directory then an fs/errors.NotDirectory error will be returned. If lastName does not have p as its directory, an fs/errors.InvalidPath error is returned. It is the caller's responsibility to call Close on the returned fs.DirIterator, otherwise resources may leak.
func (*Client) Download ¶
Download returns an fs.Reader reading from contents of the file with the path p. If no file with path p exists, an fs/errors.NotFile is returned. It is the caller's responsibility to call Close on the returned fs.Reader, otherwise resources may leak.
func (*Client) DownloadMetadata ¶
DownloadMetadata returns the metadata for the file or directory with the path p. If a file or directory with this path does not exist, an fs/errors.NotExist error is returned.
func (*Client) FilerURL ¶
FilerURL returns the URL of the SeaweedFS filer server. For example, "http://localhost:8888".
func (*Client) IsDirEmpty ¶
IsDirEmpty returns true if and only if path p exists and is an empty directory. If the path is not a directory, returns fs/errors.NotDirectory.
func (*Client) MasterURL ¶
MasterURL returns the URL of the SeaweedFS master server. For example, "http://localhost:9333".
func (*Client) Mkdir ¶
Mkdir creates the directory with the path p. If p's parent directory does not exist, an fs/errors.NotExist error is returned; if the parent exists but is not a directory then an fs/errors.NotDirectory error is returned; if a file or directory with that path already exists then an fs/errors.Exist error is returned.
func (*Client) Remove ¶
Remove attempts to remove the file or directory with the path p. If the path does not exist, an fs/errors.NotExist error is returned. If the path is a directory and is non-empty or is "/", an fs/errors.DirNotEmpty error is returned.
func (*Client) Rmdir ¶
Rmdir removes the path p if p is an empty directory. If the path is not a directory, returns fs/errors.NotDirectory; if the directory is not empty or is "/", returns fs/errors.DirNotEmpty.
func (*Client) Upload ¶
Upload returns an fs.Writer writing to the path p. If p's parent directory does not exist, an fs/errors.NotExist error is returned; if the parent exists but is not a directory then an fs/errors.NotDirectory error is returned; if a file or directory with path p already exists then an fs/errors.Exist error is returned. It is the caller's responsibility to call Close on the returned fs.Writer, otherwise resources may leak.
type ClientConfig ¶
type ClientConfig struct { Master *url.URL // The address of the master server Filer *url.URL // The address of the filer server AppName string // The application name to identify ourselves via }
ClientConfig describes the configuration options we allow a user to set on a client connection.
func DefaultConfig ¶
func DefaultConfig() *ClientConfig
DefaultConfig returns a new client configuration initialised with the default values.
func SetDefaultConfig ¶
func SetDefaultConfig(c *ClientConfig) *ClientConfig
SetDefaultConfig sets the default client configuration to c and returns the old default configuration. This change will be reflected in future calls to DefaultConfig.
func (*ClientConfig) Copy ¶
func (c *ClientConfig) Copy() *ClientConfig
Copy returns a copy of the configuration.
func (*ClientConfig) Validate ¶
func (c *ClientConfig) Validate() error
Validate validates the client configuration, returning an error if there's a problem.