-
Notifications
You must be signed in to change notification settings - Fork 1
/
syncerservice.go
35 lines (27 loc) · 1.01 KB
/
syncerservice.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
// Copyright 2023 Outreach Corporation. All Rights Reserved.
// Description: Contains the SyncerService struct and its methods.
package vcluster_fs_syncer //nolint:revive // Why: We allow [-_].
import (
"context"
"github.com/getoutreach/vcluster-fs-syncer/internal/syncer"
"github.com/sirupsen/logrus"
)
// SyncerService implements the ServiceActivity framework for
// the vcluster-fs-syncer service. This service activity is the
// wrapper for all logic that is required to run the service.
type SyncerService struct {
syncer *syncer.Syncer
}
// NewSyncerService create a new SyncerService that implements
// the core of this service's logic.
func NewSyncerService(cfg *Config) *SyncerService {
return &SyncerService{syncer.NewSyncer(cfg.FromPath, cfg.ToPath, logrus.New())}
}
// Run starts the SyncerService.
func (s *SyncerService) Run(ctx context.Context) error {
return s.syncer.Start(ctx)
}
// Close shuts down the SyncerService.
func (s *SyncerService) Close(_ context.Context) error {
return s.syncer.Close()
}