wscontents

package
v0.0.97 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FileEvent_EventType_name = map[int32]string{
		0: "UNKNOWN",
		1: "WRITE",
		2: "REMOVE",
		3: "MKDIR",
	}
	FileEvent_EventType_value = map[string]int32{
		"UNKNOWN": 0,
		"WRITE":   1,
		"REMOVE":  2,
		"MKDIR":   3,
	}
)

Enum value maps for FileEvent_EventType.

View Source
var File_internal_wscontents_types_proto protoreflect.FileDescriptor

Functions

func AggregateFSEvents

func AggregateFSEvents(watcher filewatcher.EventsAndErrors, debugLogger, errLogger io.Writer, bufferCh chan []fsnotify.Event)

func Observe

func Observe(absPath, rel string, observeChanges bool) compute.Computable[Versioned]

Observe returns a Computable that is Versioned, that is, it produces a value but can also be observed for updates. It produces a new revision whenever the filesystem is updated. Returns a Computable[Versioned]

func SnapshotContents

func SnapshotContents(ctx context.Context, modulePath, rel string) (*memfs.FS, error)

func SnapshotDirectory

func SnapshotDirectory(ctx context.Context, absPath string) (*memfs.FS, error)

Types

type FileEvent

type FileEvent struct {
	Event       FileEvent_EventType `protobuf:"varint,1,opt,name=event,proto3,enum=foundation.internal.wscontents.FileEvent_EventType" json:"event,omitempty"`
	Path        string              `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	NewContents []byte              `protobuf:"bytes,3,opt,name=new_contents,json=newContents,proto3" json:"new_contents,omitempty"`
	Mode        uint32              `protobuf:"varint,4,opt,name=mode,proto3" json:"mode,omitempty"`
	// contains filtered or unexported fields
}

func (*FileEvent) Descriptor deprecated

func (*FileEvent) Descriptor() ([]byte, []int)

Deprecated: Use FileEvent.ProtoReflect.Descriptor instead.

func (*FileEvent) GetEvent

func (x *FileEvent) GetEvent() FileEvent_EventType

func (*FileEvent) GetMode

func (x *FileEvent) GetMode() uint32

func (*FileEvent) GetNewContents

func (x *FileEvent) GetNewContents() []byte

func (*FileEvent) GetPath

func (x *FileEvent) GetPath() string

func (*FileEvent) ProtoMessage

func (*FileEvent) ProtoMessage()

func (*FileEvent) ProtoReflect

func (x *FileEvent) ProtoReflect() protoreflect.Message

func (*FileEvent) Reset

func (x *FileEvent) Reset()

func (*FileEvent) String

func (x *FileEvent) String() string

type FileEvent_EventType

type FileEvent_EventType int32
const (
	FileEvent_UNKNOWN FileEvent_EventType = 0
	FileEvent_WRITE   FileEvent_EventType = 1
	FileEvent_REMOVE  FileEvent_EventType = 2
	FileEvent_MKDIR   FileEvent_EventType = 3
)

func (FileEvent_EventType) Descriptor

func (FileEvent_EventType) Enum

func (FileEvent_EventType) EnumDescriptor deprecated

func (FileEvent_EventType) EnumDescriptor() ([]byte, []int)

Deprecated: Use FileEvent_EventType.Descriptor instead.

func (FileEvent_EventType) Number

func (FileEvent_EventType) String

func (x FileEvent_EventType) String() string

func (FileEvent_EventType) Type

type OnNewSnapshopFunc

type OnNewSnapshopFunc func(context.Context, fnfs.ReadWriteFS, []*FileEvent) (fnfs.ReadWriteFS, bool, error)

type Versioned

type Versioned interface {
	compute.Versioned
	compute.Digestible
	Abs() string
	FS() fs.FS
}

func MakeVersioned

func MakeVersioned(ctx context.Context, moduleAbsPath, rel string, observeChanges bool, onNewSnapshot OnNewSnapshopFunc) (Versioned, error)

onNewSnapshot is guaranteed to never be called concurrently.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL