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
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
func (*Tracker) Notify ¶
func (m *Tracker) Notify(ctx context.Context, fs afs.Service, callback func(URL string, operation Operation)) error
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(URL string, operation resource.Operation) { 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) } }) if err != nil { log.Fatal(err) } }
Output:
Click to show internal directories.
Click to hide internal directories.