type Client interface { SyncFiles(ctx context.Context, syncParameters SyncParameters) (bool, error) }
ComponentInfo is a struct that holds information about a component i.e.; component name, pod name, container name, and source mount (if applicable)
type ComponentInfo struct { ComponentName string PodName string ContainerName string SyncFolder string }
MockClient is a mock of Client interface.
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockClient) SyncFiles(ctx context.Context, syncParameters SyncParameters) (bool, error)
SyncFiles mocks base method.
MockClientMockRecorder is the mock recorder for MockClient.
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockClientMockRecorder) SyncFiles(ctx, syncParameters interface{}) *gomock.Call
SyncFiles indicates an expected call of SyncFiles.
SyncClient is a platform-agnostic implementation for sync
type SyncClient struct {
// contains filtered or unexported fields
}
func NewSyncClient(platformClient platform.Client, execClient exec.Client) *SyncClient
NewSyncClient instantiates a new SyncClient
func (a SyncClient) CopyFile(ctx context.Context, localPath string, compInfo ComponentInfo, targetPath string, copyFiles []string, globExps []string, ret util.IndexerRet) error
CopyFile copies localPath directory or list of files in copyFiles list to the directory in running Pod. copyFiles is list of changed files captured during `odo watch` as well as binary file path During copying binary components, localPath represent base directory path to binary and copyFiles contains path of binary During copying local source components, localPath represent base directory path whereas copyFiles is empty During `odo watch`, localPath represent base directory path whereas copyFiles contains list of changed Files
func (a SyncClient) ExtractProjectToComponent(ctx context.Context, containerName, podName, targetPath string, stdin io.Reader) error
ExtractProjectToComponent extracts the project archive(tar) to the target path from the reader stdin
func (a SyncClient) SyncFiles(ctx context.Context, syncParameters SyncParameters) (bool, error)
SyncFiles does a couple of things: if files changed/deleted are passed in from watch, it syncs them to the component otherwise, it checks which files have changed and syncs the delta it returns a boolean execRequired and an error. execRequired tells us if files have changed and devfile execution is required
type SyncExtracter func(ComponentInfo, string, io.Reader) error
SyncParameters is a struct containing the parameters to be used when syncing a devfile component
type SyncParameters struct { Path string // Path refers to the parent folder containing the source code to push up to a component WatchFiles []string // Optional: WatchFiles is the list of changed files detected by odo watch. If empty or nil, odo will check .odo/odo-file-index.json to determine changed files WatchDeletedFiles []string // Optional: WatchDeletedFiles is the list of deleted files detected by odo watch. If empty or nil, odo will check .odo/odo-file-index.json to determine deleted files IgnoredFiles []string // IgnoredFiles is the list of files to not push up to a component DevfileScanIndexForWatch bool // DevfileScanIndexForWatch is true if watch's push should regenerate the index file during SyncFiles, false otherwise. See 'pkg/sync/adapter.go' for details ForcePush bool CompInfo ComponentInfo Files map[string]string }