mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
689cf2a5ee
* Fix ui, hide report date * Undo Goland madness * UR now web scale * Fix migration * Fix marshaling, force tick on start * Fix tests * Darwin build * Split "all" build target, add package name as a tag * Remove pq and sql dep from syncthing, split build targets * Empty line * Revert "Empty line" This reverts commit f74af2b067dadda8a343714123512bd545a643c3. * Revert "Remove pq and sql dep from syncthing, split build targets" This reverts commit 8fc295ad007c5bb7886c557f492dacf51be307ad. * Revert "Split "all" build target, add package name as a tag" This reverts commit f4dc88995106d2b06042f30bea781a0feb08e55f. * Normalise contract types * Fix build add more logging
179 lines
5.0 KiB
Go
179 lines
5.0 KiB
Go
// Copyright (C) 2016 The Syncthing Authors.
|
|
//
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
package api
|
|
|
|
import (
|
|
"net"
|
|
"time"
|
|
|
|
"github.com/syncthing/syncthing/lib/connections"
|
|
"github.com/syncthing/syncthing/lib/db"
|
|
"github.com/syncthing/syncthing/lib/model"
|
|
"github.com/syncthing/syncthing/lib/protocol"
|
|
"github.com/syncthing/syncthing/lib/stats"
|
|
"github.com/syncthing/syncthing/lib/ur/contract"
|
|
"github.com/syncthing/syncthing/lib/versioner"
|
|
)
|
|
|
|
type mockedModel struct{}
|
|
|
|
func (m *mockedModel) GlobalDirectoryTree(folder, prefix string, levels int, dirsonly bool) map[string]interface{} {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) Completion(device protocol.DeviceID, folder string) model.FolderCompletion {
|
|
return model.FolderCompletion{}
|
|
}
|
|
|
|
func (m *mockedModel) Override(folder string) {}
|
|
|
|
func (m *mockedModel) Revert(folder string) {}
|
|
|
|
func (m *mockedModel) NeedFolderFiles(folder string, page, perpage int) ([]db.FileInfoTruncated, []db.FileInfoTruncated, []db.FileInfoTruncated) {
|
|
return nil, nil, nil
|
|
}
|
|
|
|
func (m *mockedModel) FolderProgressBytesCompleted(_ string) int64 {
|
|
return 0
|
|
}
|
|
|
|
func (m *mockedModel) ConnectionStats() map[string]interface{} {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) DeviceStatistics() (map[string]stats.DeviceStatistics, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *mockedModel) FolderStatistics() (map[string]stats.FolderStatistics, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *mockedModel) CurrentFolderFile(folder string, file string) (protocol.FileInfo, bool) {
|
|
return protocol.FileInfo{}, false
|
|
}
|
|
|
|
func (m *mockedModel) CurrentGlobalFile(folder string, file string) (protocol.FileInfo, bool) {
|
|
return protocol.FileInfo{}, false
|
|
}
|
|
|
|
func (m *mockedModel) ResetFolder(folder string) {
|
|
}
|
|
|
|
func (m *mockedModel) Availability(folder string, file protocol.FileInfo, block protocol.BlockInfo) []model.Availability {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) GetIgnores(folder string) ([]string, []string, error) {
|
|
return nil, nil, nil
|
|
}
|
|
|
|
func (m *mockedModel) SetIgnores(folder string, content []string) error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) GetFolderVersions(folder string) (map[string][]versioner.FileVersion, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *mockedModel) RestoreFolderVersions(folder string, versions map[string]time.Time) (map[string]string, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *mockedModel) PauseDevice(device protocol.DeviceID) {
|
|
}
|
|
|
|
func (m *mockedModel) ResumeDevice(device protocol.DeviceID) {}
|
|
|
|
func (m *mockedModel) DelayScan(folder string, next time.Duration) {}
|
|
|
|
func (m *mockedModel) ScanFolder(folder string) error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) ScanFolders() map[string]error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) ScanFolderSubdirs(folder string, subs []string) error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) BringToFront(folder, file string) {}
|
|
|
|
func (m *mockedModel) Connection(deviceID protocol.DeviceID) (connections.Connection, bool) {
|
|
return nil, false
|
|
}
|
|
|
|
func (m *mockedModel) State(folder string) (string, time.Time, error) {
|
|
return "", time.Time{}, nil
|
|
}
|
|
|
|
func (m *mockedModel) UsageReportingStats(r *contract.Report, version int, preview bool) {
|
|
}
|
|
|
|
func (m *mockedModel) FolderErrors(folder string) ([]model.FileError, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *mockedModel) WatchError(folder string) error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) Serve() {}
|
|
func (m *mockedModel) Stop() {}
|
|
|
|
func (m *mockedModel) Index(deviceID protocol.DeviceID, folder string, files []protocol.FileInfo) error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) IndexUpdate(deviceID protocol.DeviceID, folder string, files []protocol.FileInfo) error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) Request(deviceID protocol.DeviceID, folder, name string, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (protocol.RequestResponse, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *mockedModel) ClusterConfig(deviceID protocol.DeviceID, config protocol.ClusterConfig) error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) Closed(conn protocol.Connection, err error) {}
|
|
|
|
func (m *mockedModel) DownloadProgress(deviceID protocol.DeviceID, folder string, updates []protocol.FileDownloadProgressUpdate) error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) AddConnection(conn connections.Connection, hello protocol.HelloResult) {}
|
|
|
|
func (m *mockedModel) OnHello(protocol.DeviceID, net.Addr, protocol.HelloResult) error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) GetHello(protocol.DeviceID) protocol.HelloIntf {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockedModel) StartDeadlockDetector(timeout time.Duration) {}
|
|
|
|
func (m *mockedModel) DBSnapshot(_ string) (*db.Snapshot, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
type mockedFolderSummaryService struct{}
|
|
|
|
func (m *mockedFolderSummaryService) Serve() {}
|
|
|
|
func (m *mockedFolderSummaryService) Stop() {}
|
|
|
|
func (m *mockedFolderSummaryService) Summary(folder string) (map[string]interface{}, error) {
|
|
return map[string]interface{}{"mocked": true}, nil
|
|
}
|
|
|
|
func (m *mockedFolderSummaryService) OnEventRequest() {}
|