Documentation
¶
Index ¶
- Constants
- Variables
- type BlobReader
- type ConfigProvider
- type Handler
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Shutdown(ctx context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- type InMemoryBackend
- func (b *InMemoryBackend) Accounts() []string
- func (b *InMemoryBackend) ApplyShare(accountName, shareName string, tree ShareTree) error
- func (b *InMemoryBackend) ExportShare(accountName, shareName string) (ShareTree, error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) SetShareRetention(account string, enabled bool, days int32)
- func (b *InMemoryBackend) ShareRetention(account string) (bool, int32)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- type Provider
- type Settings
- type ShareTree
Constants ¶
const DefaultPort = 10009
DefaultPort is Azure Files' fixed listener port; Azurite has no Files service, so this is the first free slot after the Azure data-plane block.
Variables ¶
var ErrNilAppContext = errors.New("azurefile: nil app context")
ErrNilAppContext is returned when Init is called with a nil AppContext.
ErrShareNotFound is returned when a share named by ExportShare or ApplyShare does not exist.
var ErrSnapshotNull = errors.New("azurefile: restore snapshot: null entry")
ErrSnapshotNull is returned by Restore when a snapshot holds a null entry.
Functions ¶
This section is empty.
Types ¶
type BlobReader ¶
BlobReader reads blobs from the emulator's own Azure Blob service, for Copy File and Put Range From URL sources.
type ConfigProvider ¶
type ConfigProvider interface {
GetAzureFileSettings() Settings
}
ConfigProvider extracts Azure Files configuration from the AppContext Config.
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
// Blobs resolves blob copy sources; nil rejects them.
Blobs BlobReader
// Now is the clock; nil means time.Now.
Now func() time.Time
// Port is the fixed TCP port StartWorker binds.
Port int
// BlobPort is the Blob listener port, used to recognise blob source URLs.
BlobPort int
// VerifyAuth makes requests signed with the development account's key
// (Shared Key or SAS) fail when the signature is wrong or expired.
VerifyAuth bool
// contains filtered or unexported fields
}
Handler serves the Azure Files REST API on a dedicated listener.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates a Handler on DefaultPort.
func (*Handler) ExtractOperation ¶
ExtractOperation names the operation for metrics.
func (*Handler) ExtractResource ¶
ExtractResource returns the share name for metrics.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists the supported operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler for Azure Files requests.
func (*Handler) MatchPriority ¶
MatchPriority is irrelevant because RouteMatcher never matches.
func (*Handler) RouteMatcher ¶
RouteMatcher never matches: Azure Files runs on its own listener.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend holds every account's shares behind one coarse lock.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates an empty backend.
func (*InMemoryBackend) Accounts ¶
func (b *InMemoryBackend) Accounts() []string
Accounts lists the storage accounts that currently hold at least one share.
func (*InMemoryBackend) ApplyShare ¶
func (b *InMemoryBackend) ApplyShare(accountName, shareName string, tree ShareTree) error
ApplyShare makes the share's contents match tree: new files are created, changed files rewritten, and files and directories absent from tree removed. Unchanged files keep their properties.
func (*InMemoryBackend) ExportShare ¶
func (b *InMemoryBackend) ExportShare(accountName, shareName string) (ShareTree, error)
ExportShare returns a copy of the share's files and directories.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads backend state from a snapshot. It implements persistence.Persistable.
func (*InMemoryBackend) SetShareRetention ¶
func (b *InMemoryBackend) SetShareRetention(account string, enabled bool, days int32)
SetShareRetention sets the account's share soft-delete policy (the management-plane shareDeleteRetentionPolicy).
func (*InMemoryBackend) ShareRetention ¶
func (b *InMemoryBackend) ShareRetention(account string) (bool, int32)
ShareRetention returns the account's share soft-delete policy.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Azure Files. Like the other Azure data-plane services it never joins the shared AWS router: the Handler runs its own listener (see Handler.StartWorker).
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init builds the backend and handler; the port is bound later in StartWorker.
type Settings ¶
type Settings struct {
Port int `` //nolint:lll // config struct tags are intentionally verbose
/* 197-byte string literal not displayed */
VerifyAuth bool `` //nolint:lll // config struct tags are intentionally verbose
/* 188-byte string literal not displayed */
}
Settings holds Azure Files configuration, embedded in the root CLI.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the default Settings.