forked from pydio/cells
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugins.go
49 lines (41 loc) · 868 Bytes
/
plugins.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package test
import (
"context"
"fmt"
"sync"
"time"
"github.com/micro/go-micro"
"github.com/pydio/cells/common/micro/router"
"github.com/pydio/cells/common/plugins"
"github.com/pydio/cells/common/service"
)
func init() {
lock := &sync.Mutex{}
plugins.Register(func(ctx context.Context) {
service.NewService(
service.Name("testing"),
service.Context(ctx),
service.WithMicro(func(m micro.Service) error {
r := router.NewRouter()
fmt.Println(r)
go func() {
<-time.After(1 * time.Second)
ticker := time.NewTicker(10 * time.Millisecond)
for {
select {
case <-ticker.C:
lock.Lock()
meta := m.Server().Options().Metadata
fmt.Println("Writing")
meta["testing"] = "testing"
//_ = c
//_ = ok
lock.Unlock()
}
}
}()
return nil
}),
)
})
}