Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( Undefined = -1 Added = Operation(iota) Modified Deleted )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct {
SourceURL string
Compressed bool
Source storage.Object
CheckFrequency time.Duration
// contains filtered or unexported fields
}
Asset represents a storage asset
func (*Asset) HasChanged ¶
type Assets ¶
Assets represents storage assets
func (Assets) Added ¶
func (a Assets) Added(ctx context.Context, assets Assets, fn func(ctx context.Context, object storage.Object))
Added calls a callback with added assets
type Error ¶ added in v1.9.0
type Error struct {
Errors []error
// contains filtered or unexported fields
}
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
func (*Tracker) Notify ¶
Notify returns true if resource under base URL have changed
Example ¶
package main
import (
"context"
"fmt"
"github.com/viant/afs"
"github.com/viant/cloudless/resource"
"log"
"time"
)
func main() {
watchURL := "myProto://myBucket/myFolder"
tracker := resource.New(watchURL, time.Second)
fs := afs.New()
err := tracker.Notify(context.Background(), fs, func(ctx context.Context, URL string, operation resource.Operation) error {
switch operation {
case resource.Added:
fmt.Printf("addd :%v", URL)
case resource.Modified:
fmt.Printf("addd :%v", URL)
case resource.Deleted:
fmt.Printf("addd :%v", URL)
}
return nil
})
if err != nil {
log.Fatal(err)
}
}
Click to show internal directories.
Click to hide internal directories.