Documentation
¶
Index ¶
- Constants
- Variables
- func StableError(err error) (string, bool)
- func Sync(resource io.Closer) error
- type ChunkReader
- type ChunkWriter
- type DirectoryEntry
- type DirectoryPage
- type DirectoryStream
- type Entry
- type FileKind
- type FileStat
- type FullDuplexResource
- type HTTPRequest
- type HTTPResponse
- type HTTPUpload
- func (upload *HTTPUpload) Abort(cause error) error
- func (upload *HTTPUpload) Close() error
- func (upload *HTTPUpload) Finish() (*HTTPResponse, error)
- func (upload *HTTPUpload) Write(value []byte) (int, error)
- func (upload *HTTPUpload) WriteChunk(ctx context.Context, value []byte, flags uint32) (int, error)
- type HandleID
- type Header
- type Invocation
- type Kind
- type Lifetime
- type Limits
- type Mount
- func (mount Mount) Close() error
- func (mount Mount) Copy(from, to URI, overwrite bool, mode fs.FileMode) error
- func (mount Mount) Mkdir(uri URI, recursive bool, mode fs.FileMode) error
- func (mount Mount) OpenDirectory(uri URI) (*DirectoryStream, error)
- func (mount Mount) OpenFile(uri URI, options OpenOptions) (*os.File, error)
- func (mount Mount) OpenWatch(uri URI) (*WatchStream, error)
- func (mount Mount) Remove(uri URI, recursive bool) error
- func (mount Mount) Rename(from, to URI, overwrite bool) error
- func (mount Mount) SetTimes(uri URI, accessed, modified time.Time) error
- func (mount Mount) Stat(uri URI, followSymlinks bool) (FileStat, error)
- type MountResolver
- type MountSpec
- type NetworkAuthorization
- type NetworkAuthorizer
- type OpenOptions
- type OwnedChunkWriter
- type Owner
- type Plugin
- type RedirectMode
- type Service
- func (service *Service) Close(invocation Invocation, handle uint64) error
- func (service *Service) Control(ctx context.Context, invocation Invocation, raw []byte) ([]byte, error)
- func (service *Service) Read(ctx context.Context, invocation Invocation, handle uint64, destination []byte) (int, uint32, error)
- func (service *Service) Revoke(predicate func(Owner) bool) error
- func (service *Service) Seek(invocation Invocation, handle uint64, offset int64, whence int) (int64, error)
- func (service *Service) Write(ctx context.Context, invocation Invocation, handle uint64, source []byte, ...) (int, error)
- type TCPConnectOptions
- type TCPListener
- type TCPShutdown
- type TCPStream
- type Table
- func (table *Table) Close(id HandleID, owner Owner) error
- func (table *Table) Len() int
- func (table *Table) Open(owner Owner, kind Kind, resource io.Closer) (HandleID, error)
- func (table *Table) Read(ctx context.Context, id HandleID, owner Owner, destination []byte) (int, error)
- func (table *Table) ReadChunk(ctx context.Context, id HandleID, owner Owner, destination []byte) (int, uint32, error)
- func (table *Table) Revoke(predicate func(Owner) bool) error
- func (table *Table) Seek(id HandleID, owner Owner, offset int64, whence int) (int64, error)
- func (table *Table) Use(id HandleID, owner Owner, kind Kind, use func(io.Closer) error) error
- func (table *Table) UseControl(id HandleID, owner Owner, kind Kind, use func(io.Closer) error) error
- func (table *Table) Write(ctx context.Context, id HandleID, owner Owner, source []byte) (int, error)
- func (table *Table) WriteChunk(ctx context.Context, id HandleID, owner Owner, source []byte, flags uint32) (int, error)
- type UDPResource
- type URI
- type WatchEvent
- type WatchKind
- type WatchStream
- type WebSocketConnection
- type WebSocketOpen
- type WebSocketResource
- func (resource *WebSocketResource) Close() error
- func (*WebSocketResource) FullDuplexResource()
- func (resource *WebSocketResource) GracefulClose(code websocket.StatusCode, reason string) error
- func (resource *WebSocketResource) Ping(ctx context.Context) error
- func (resource *WebSocketResource) ReadChunk(ctx context.Context, destination []byte) (int, uint32, error)
- func (resource *WebSocketResource) WriteOwnedChunk(ctx context.Context, owner Owner, source []byte, flags uint32) (int, error)
Constants ¶
View Source
const ( PermissionFSWorkspaceRead = "fs.workspace.read" PermissionFSWorkspaceWrite = "fs.workspace.write" PermissionFSHomeRead = "fs.home.read" PermissionFSHomeWrite = "fs.home.write" PermissionFSEnvironmentRead = "fs.environment.read" PermissionFSEnvironmentWrite = "fs.environment.write" PermissionNetworkClient = "network.client" PermissionNetworkListen = "network.listen" )
View Source
const ( IOFlagEOF uint32 = 1 << 0 IOFlagText uint32 = 1 << 1 IOFlagBinary uint32 = 1 << 2 IOFlagMessageEnd uint32 = 1 << 3 IOFlagDatagramEnd uint32 = 1 << 4 )
View Source
const ( MinimumFileHandles = 64 MinimumConnections = 32 MinimumWatchesListeners = 8 )
View Source
const MaxIOChunkBytes = 64 << 10
View Source
const PluginAPI uint16 = 1
Variables ¶
View Source
var ( ErrCrossDevice = errors.New("cross-device operation is not allowed") ErrUnsafeFile = errors.New("filesystem object is unsafe") ErrInvalidOptions = errors.New("file open options are invalid") ErrWatchUnsupported = errors.New("filesystem watch is unavailable") )
View Source
var ( ErrInvalidHandle = errors.New("resource handle is invalid") ErrResourceClosed = errors.New("resource is closed") ErrOwnerMismatch = errors.New("resource handle owner mismatch") ErrResourceLimit = errors.New("resource limit exceeded") )
View Source
var ErrInvalidURI = errors.New("invalid redevfs URI")
View Source
var ErrRedirectRequiresReplay = errors.New("redirect requires request body replay")
Functions ¶
func StableError ¶
StableError projects broker failures onto the closed Worker API error set.
Types ¶
type ChunkReader ¶
type ChunkWriter ¶
type DirectoryEntry ¶
type DirectoryPage ¶
type DirectoryPage struct {
Entries []DirectoryEntry `json:"entries"`
EOF bool `json:"eof"`
}
type DirectoryStream ¶
type DirectoryStream struct {
// contains filtered or unexported fields
}
func (*DirectoryStream) Close ¶
func (stream *DirectoryStream) Close() error
func (*DirectoryStream) Next ¶
func (stream *DirectoryStream) Next(limit int) (DirectoryPage, error)
type FullDuplexResource ¶
type FullDuplexResource interface {
FullDuplexResource()
}
type HTTPRequest ¶
type HTTPResponse ¶
type HTTPResponse struct {
Status int
Headers []Header
FinalURL string
Body io.ReadCloser
}
type HTTPUpload ¶
type HTTPUpload struct {
// contains filtered or unexported fields
}
func BeginHTTP ¶
func BeginHTTP(ctx context.Context, request HTTPRequest) (*HTTPUpload, error)
func (*HTTPUpload) Abort ¶
func (upload *HTTPUpload) Abort(cause error) error
func (*HTTPUpload) Close ¶
func (upload *HTTPUpload) Close() error
func (*HTTPUpload) Finish ¶
func (upload *HTTPUpload) Finish() (*HTTPResponse, error)
func (*HTTPUpload) WriteChunk ¶
type Invocation ¶
type Limits ¶
func DefaultLimits ¶
func DefaultLimits() Limits
type Mount ¶
type Mount struct {
ID string
Root *os.Root
ReadOnly bool
Scope sessionctx.ResourceScope
}
func OpenMount ¶
func OpenMount(id, path string, readOnly bool, scope sessionctx.ResourceScope) (Mount, error)
func (Mount) OpenDirectory ¶
func (mount Mount) OpenDirectory(uri URI) (*DirectoryStream, error)
type MountResolver ¶
type NetworkAuthorization ¶
type NetworkAuthorization struct {
Invocation Invocation
Operation string
Destination *url.URL
Listen bool
}
type NetworkAuthorizer ¶
type NetworkAuthorizer interface {
AuthorizeNetwork(context.Context, NetworkAuthorization) error
}
type OpenOptions ¶
type OwnedChunkWriter ¶
type Owner ¶
type Owner struct {
PluginInstanceID string
ActiveFingerprint string
Scope sessionctx.ResourceScope
Session sessionctx.SessionScope
RuntimeGeneration string
ManagementRevision uint64
RevokeEpoch uint64
InvocationID string
Lifetime Lifetime
}
type RedirectMode ¶
type RedirectMode string
const ( RedirectFollow RedirectMode = "follow" RedirectManual RedirectMode = "manual" RedirectError RedirectMode = "error" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(table *Table, mounts MountResolver, network NetworkAuthorizer) (*Service, error)
type TCPConnectOptions ¶
type TCPListener ¶
type TCPListener struct {
// contains filtered or unexported fields
}
func (*TCPListener) Address ¶
func (listener *TCPListener) Address() string
func (*TCPListener) Close ¶
func (listener *TCPListener) Close() error
type TCPShutdown ¶
type TCPShutdown string
const ( TCPShutdownRead TCPShutdown = "read" TCPShutdownWrite TCPShutdown = "write" TCPShutdownBoth TCPShutdown = "both" )
type TCPStream ¶
type TCPStream struct {
// contains filtered or unexported fields
}
func (*TCPStream) FullDuplexResource ¶
func (*TCPStream) FullDuplexResource()
func (*TCPStream) Shutdown ¶
func (stream *TCPStream) Shutdown(direction TCPShutdown) error
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func NewTableWithLimits ¶
func (*Table) UseControl ¶
func (table *Table) UseControl(id HandleID, owner Owner, kind Kind, use func(io.Closer) error) error
UseControl serializes control operations without waiting for a blocked read or write on a full-duplex resource.
type UDPResource ¶
type UDPResource struct {
// contains filtered or unexported fields
}
func (*UDPResource) Close ¶
func (resource *UDPResource) Close() error
func (*UDPResource) FullDuplexResource ¶
func (*UDPResource) FullDuplexResource()
func (*UDPResource) WriteChunk ¶
type WatchEvent ¶
type WatchStream ¶
type WatchStream struct {
// contains filtered or unexported fields
}
func (*WatchStream) Close ¶
func (stream *WatchStream) Close() error
func (*WatchStream) Next ¶
func (stream *WatchStream) Next(ctx context.Context, timeout time.Duration) (WatchEvent, error)
type WebSocketConnection ¶
type WebSocketConnection struct {
Resource *WebSocketResource
Protocol string
ResponseHeaders []Header
}
func OpenWebSocket ¶
func OpenWebSocket(ctx context.Context, request WebSocketOpen) (WebSocketConnection, error)
type WebSocketOpen ¶
type WebSocketResource ¶
type WebSocketResource struct {
// contains filtered or unexported fields
}
func (*WebSocketResource) Close ¶
func (resource *WebSocketResource) Close() error
func (*WebSocketResource) FullDuplexResource ¶
func (*WebSocketResource) FullDuplexResource()
func (*WebSocketResource) GracefulClose ¶
func (resource *WebSocketResource) GracefulClose(code websocket.StatusCode, reason string) error
func (*WebSocketResource) WriteOwnedChunk ¶
Click to show internal directories.
Click to hide internal directories.