From 132fd965af9069daccd0fda4cffd6f2e81405ae0 Mon Sep 17 00:00:00 2001 From: Jacob Howard Date: Mon, 27 Jun 2022 15:42:45 -0600 Subject: [PATCH 1/2] cli: relocate endpoint configuration and state in template structures Even though our internal representation is vastly different, it makes more sense to embed endpoint configuration and state alongside URL fields in our public-facing representations. Signed-off-by: Jacob Howard --- pkg/api/models/forwarding/endpoint.go | 61 ++++++++++ .../{url_test.go => endpoint_test.go} | 0 pkg/api/models/forwarding/session.go | 57 ++++----- pkg/api/models/forwarding/url.go | 35 ------ pkg/api/models/synchronization/endpoint.go | 110 +++++++++++++++++ .../{url_test.go => endpoint_test.go} | 0 pkg/api/models/synchronization/session.go | 114 ++++-------------- pkg/api/models/synchronization/url.go | 35 ------ 8 files changed, 213 insertions(+), 199 deletions(-) create mode 100644 pkg/api/models/forwarding/endpoint.go rename pkg/api/models/forwarding/{url_test.go => endpoint_test.go} (100%) delete mode 100644 pkg/api/models/forwarding/url.go create mode 100644 pkg/api/models/synchronization/endpoint.go rename pkg/api/models/synchronization/{url_test.go => endpoint_test.go} (100%) delete mode 100644 pkg/api/models/synchronization/url.go diff --git a/pkg/api/models/forwarding/endpoint.go b/pkg/api/models/forwarding/endpoint.go new file mode 100644 index 00000000..f7577ce2 --- /dev/null +++ b/pkg/api/models/forwarding/endpoint.go @@ -0,0 +1,61 @@ +package forwarding + +import ( + "github.com/mutagen-io/mutagen/pkg/forwarding" + "github.com/mutagen-io/mutagen/pkg/url" +) + +// Endpoint represents a forwarding endpoint. +type Endpoint struct { + // Protocol endpoint transport protocol. + Protocol url.Protocol `json:"protocol"` + // User is the endpoint user. + User string `json:"user,omitempty"` + // Host is the endpoint host. + Host string `json:"host,omitempty"` + // Port is the endpoint port. + Port uint16 `json:"port,omitempty"` + // Endpoint is the listening or dialing address on the endpoint. + Endpoint string `json:"endpoint,omitempty"` + // Environment is the environment variable map to use for the transport. + Environment map[string]string `json:"environment,omitempty"` + // Parameters is the parameter map to use for the transport. + Parameters map[string]string `json:"parameters,omitempty"` + // Configuration is the endpoint-specific configuration. + Configuration + // Connected indicates whether or not the controller is currently connected + // to the endpoint. + Connected bool `json:"connected"` + // EndpointState stores state fields relevant to connected endpoints. It is + // non-nil if and only if the endpoint is connected. + *EndpointState +} + +// EndpointState encodes the current state of a forwarding endpoint. +type EndpointState struct{} + +// loadFromInternal sets an Endpoint to match internal Protocol Buffers +// representations. All parameters must be valid. +func (e *Endpoint) loadFromInternal(url *url.URL, configuration *forwarding.Configuration, state *forwarding.EndpointState) { + // Propagate URL parameters. + e.Protocol = url.Protocol + e.User = url.User + e.Host = url.Host + e.Port = uint16(url.Port) + e.Endpoint = url.Path + e.Environment = url.Environment + e.Parameters = url.Parameters + + // Propagate configuration. + e.Configuration.loadFromInternal(configuration) + + // Propagate connectivity. + e.Connected = state.Connected + + // Propagate other state fields. + if !e.Connected { + e.EndpointState = nil + } else { + e.EndpointState = &EndpointState{} + } +} diff --git a/pkg/api/models/forwarding/url_test.go b/pkg/api/models/forwarding/endpoint_test.go similarity index 100% rename from pkg/api/models/forwarding/url_test.go rename to pkg/api/models/forwarding/endpoint_test.go diff --git a/pkg/api/models/forwarding/session.go b/pkg/api/models/forwarding/session.go index 28ffd9ad..0a8a337b 100644 --- a/pkg/api/models/forwarding/session.go +++ b/pkg/api/models/forwarding/session.go @@ -17,36 +17,25 @@ type Session struct { CreationTime string `json:"creationTime"` // CreatingVersion is the version of Mutagen that created the session. CreatingVersion string `json:"creatingVersion"` - // Source is the source endpoint URL. - Source URL `json:"source"` - // Destination is the destination endpoint URL. - Destination URL `json:"destination"` + // Source stores the source endpoint's configuration and state. + Source Endpoint `json:"source"` + // Destination stores the destination endpoint's configuration and state. + Destination Endpoint `json:"destination"` // Configuration is the session configuration. Configuration - // ConfigurationSource is the source endpoint configuration. - ConfigurationSource Configuration `json:"configurationSource"` - // ConfigurationDestination is the destination endpoint configuration. - ConfigurationDestination Configuration `json:"configurationDestination"` // Name is the session name. Name string `json:"name,omitempty"` // Label are the session labels. Labels map[string]string `json:"labels,omitempty"` // Paused indicates whether or not the session is paused. Paused bool `json:"paused"` - // State stores state fields relevant to running sessions. It is non-nil if - // and only if the session is unpaused. - *State + // SessionState stores state fields relevant to running sessions. It is + // non-nil if and only if the session is unpaused. + *SessionState } -// EndpointState encodes the current state of a forwarding endpoint. -type EndpointState struct { - // Connected indicates whether or not the controller is currently connected - // to the endpoint. - Connected bool `json:"connected"` -} - -// State encodes fields relevant to unpaused sessions. -type State struct { +// SessionState encodes fields relevant to unpaused sessions. +type SessionState struct { // Status is the session status. Status forwarding.Status `json:"status"` // LastError is the last forwarding error to occur. @@ -63,10 +52,6 @@ type State struct { // TotalInboundData is the total amount of data (in bytes) that has been // transmitted from destination to source across all forwarded connections. TotalInboundData uint64 `json:"totalInboundData"` - // SourceState encodes the state of the source endpoint. - SourceState EndpointState `json:"sourceState"` - // DestinationState encodes the state of the destination endpoint. - DestinationState EndpointState `json:"destinationState"` } // loadFromInternal sets a session to match an internal Protocol Buffers session @@ -86,31 +71,31 @@ func (s *Session) loadFromInternal(state *forwarding.State) { s.Paused = state.Session.Paused // Propagate endpoint information. - s.Source.loadFromInternal(state.Session.Source) - s.Destination.loadFromInternal(state.Session.Destination) + s.Source.loadFromInternal( + state.Session.Source, + state.Session.ConfigurationSource, + state.SourceState, + ) + s.Destination.loadFromInternal( + state.Session.Destination, + state.Session.ConfigurationDestination, + state.DestinationState, + ) // Propagate configuration information. s.Configuration.loadFromInternal(state.Session.Configuration) - s.ConfigurationSource.loadFromInternal(state.Session.ConfigurationSource) - s.ConfigurationDestination.loadFromInternal(state.Session.ConfigurationDestination) // Propagate state information if the session isn't paused. if state.Session.Paused { - s.State = nil + s.SessionState = nil } else { - s.State = &State{ + s.SessionState = &SessionState{ Status: state.Status, LastError: state.LastError, OpenConnections: state.OpenConnections, TotalConnections: state.TotalConnections, TotalOutboundData: state.TotalOutboundData, TotalInboundData: state.TotalInboundData, - SourceState: EndpointState{ - Connected: state.SourceState.Connected, - }, - DestinationState: EndpointState{ - Connected: state.DestinationState.Connected, - }, } } } diff --git a/pkg/api/models/forwarding/url.go b/pkg/api/models/forwarding/url.go deleted file mode 100644 index 04f7e15b..00000000 --- a/pkg/api/models/forwarding/url.go +++ /dev/null @@ -1,35 +0,0 @@ -package forwarding - -import ( - "github.com/mutagen-io/mutagen/pkg/url" -) - -// URL represents forwarding endpoint URL. -type URL struct { - // Protocol endpoint transport protocol. - Protocol url.Protocol `json:"protocol"` - // User is the endpoint user. - User string `json:"user,omitempty"` - // Host is the endpoint host. - Host string `json:"host,omitempty"` - // Port is the endpoint port. - Port uint16 `json:"port,omitempty"` - // Endpoint is the listening or dialing address on the endpoint. - Endpoint string `json:"endpoint,omitempty"` - // Environment is the environment variable map to use for the transport. - Environment map[string]string `json:"environment,omitempty"` - // Parameters is the parameter map to use for the transport. - Parameters map[string]string `json:"parameters,omitempty"` -} - -// loadFromInternal sets a URL to match an internal Protocol Buffers -// representation. The URL must be a valid forwarding URL. -func (u *URL) loadFromInternal(url *url.URL) { - u.Protocol = url.Protocol - u.User = url.User - u.Host = url.Host - u.Port = uint16(url.Port) - u.Endpoint = url.Path - u.Environment = url.Environment - u.Parameters = url.Parameters -} diff --git a/pkg/api/models/synchronization/endpoint.go b/pkg/api/models/synchronization/endpoint.go new file mode 100644 index 00000000..6d49b58b --- /dev/null +++ b/pkg/api/models/synchronization/endpoint.go @@ -0,0 +1,110 @@ +package synchronization + +import ( + "github.com/mutagen-io/mutagen/pkg/synchronization" + "github.com/mutagen-io/mutagen/pkg/url" +) + +// Endpoint represents a synchronization endpoint. +type Endpoint struct { + // Protocol endpoint transport protocol. + Protocol url.Protocol `json:"protocol"` + // User is the endpoint user. + User string `json:"user,omitempty"` + // Host is the endpoint host. + Host string `json:"host,omitempty"` + // Port is the endpoint port. + Port uint16 `json:"port,omitempty"` + // Path is the synchronization root on the endpoint. + Path string `json:"path,omitempty"` + // Environment is the environment variable map to use for the transport. + Environment map[string]string `json:"environment,omitempty"` + // Parameters is the parameter map to use for the transport. + Parameters map[string]string `json:"parameters,omitempty"` + // Configuration is the endpoint-specific configuration. + Configuration + // Connected indicates whether or not the controller is currently connected + // to the endpoint. + Connected bool `json:"connected"` + // EndpointState stores state fields relevant to connected endpoints. It is + // non-nil if and only if the endpoint is connected. + *EndpointState +} + +// EndpointState encodes the current state of a synchronization endpoint. +type EndpointState struct { + // Scanned indicates whether or not at least one scan has been performed on + // the endpoint. + Scanned bool `json:"scanned"` + // DirectoryCount is the number of synchronizable directory entries + // contained in the last snapshot from the endpoint. + DirectoryCount uint64 `json:"directoryCount,omitempty"` + // FileCount is the number of synchronizable file entries contained in the + // last snapshot from the endpoint. + FileCount uint64 `json:"fileCount,omitempty"` + // SymbolicLinkCount is the number of synchronizable symbolic link entries + // contained in the last snapshot from the endpoint. + SymbolicLinkCount uint64 `json:"symbolicLinkCount,omitempty"` + // TotalFileSize is the total size of all synchronizable files referenced by + // the last snapshot from the endpoint. + TotalFileSize uint64 `json:"totalFileSize,omitempty"` + // ScanProblems is the list of non-terminal problems encountered during the + // last scanning operation on the endpoint. This list may be a truncated + // version of the full list if too many problems are encountered to report + // via the API, in which case ExcludedScanProblems will be non-zero. + ScanProblems []Problem `json:"scanProblems,omitempty"` + // ExcludedScanProblems is the number of problems that have been excluded + // from ScanProblems due to truncation. This value can be non-zero only if + // ScanProblems is non-empty. + ExcludedScanProblems uint64 `json:"excludedScanProblems,omitempty"` + // TransitionProblems is the list of non-terminal problems encountered + // during the last transition operation on the endpoint. This list may be a + // truncated version of the full list if too many problems are encountered + // to report via the API, in which case ExcludedTransitionProblems will be + // non-zero. + TransitionProblems []Problem `json:"transitionProblems,omitempty"` + // ExcludedTransitionProblems is the number of problems that have been + // excluded from TransitionProblems due to truncation. This value can be + // non-zero only if TransitionProblems is non-empty. + ExcludedTransitionProblems uint64 `json:"excludedTransitionProblems,omitempty"` + // StagingProgress is the rsync staging progress. It is non-nil if and only + // if the endpoint is currently staging files. + StagingProgress *ReceiverState `json:"stagingProgress,omitempty"` +} + +// loadFromInternal sets an Endpoint to match internal Protocol Buffers +// representations. All parameters must be valid. +func (e *Endpoint) loadFromInternal(url *url.URL, configuration *synchronization.Configuration, state *synchronization.EndpointState) { + // Propagate URL parameters. + e.Protocol = url.Protocol + e.User = url.User + e.Host = url.Host + e.Port = uint16(url.Port) + e.Path = url.Path + e.Environment = url.Environment + e.Parameters = url.Parameters + + // Propagate configuration. + e.Configuration.loadFromInternal(configuration) + + // Propagate connectivity. + e.Connected = state.Connected + + // Propagate other state fields. + if !e.Connected { + e.EndpointState = nil + } else { + e.EndpointState = &EndpointState{ + Scanned: state.Scanned, + DirectoryCount: state.DirectoryCount, + FileCount: state.FileCount, + SymbolicLinkCount: state.SymbolicLinkCount, + TotalFileSize: state.TotalFileSize, + ScanProblems: exportProblems(state.ScanProblems), + ExcludedScanProblems: state.ExcludedScanProblems, + TransitionProblems: exportProblems(state.TransitionProblems), + ExcludedTransitionProblems: state.ExcludedTransitionProblems, + StagingProgress: newReceiverStateFromInternalReceiverState(state.StagingProgress), + } + } +} diff --git a/pkg/api/models/synchronization/url_test.go b/pkg/api/models/synchronization/endpoint_test.go similarity index 100% rename from pkg/api/models/synchronization/url_test.go rename to pkg/api/models/synchronization/endpoint_test.go diff --git a/pkg/api/models/synchronization/session.go b/pkg/api/models/synchronization/session.go index 73305a9f..c519ba7e 100644 --- a/pkg/api/models/synchronization/session.go +++ b/pkg/api/models/synchronization/session.go @@ -17,73 +17,25 @@ type Session struct { CreationTime string `json:"creationTime"` // CreatingVersion is the version of Mutagen that created the session. CreatingVersion string `json:"creatingVersion"` - // Alpha is the alpha endpoint URL. - Alpha URL `json:"alpha"` - // Beta is the beta endpoint URL. - Beta URL `json:"beta"` + // Alpha stores the alpha endpoint's configuration and state. + Alpha Endpoint `json:"alpha"` + // Beta stores the beta endpoint's configuration and state. + Beta Endpoint `json:"beta"` // Configuration is the session configuration. Configuration - // ConfigurationAlpha is the alpha endpoint configuration. - ConfigurationAlpha Configuration `json:"configurationAlpha"` - // ConfigurationBeta is the beta endpoint configuration. - ConfigurationBeta Configuration `json:"configurationBeta"` // Name is the session name. Name string `json:"name,omitempty"` // Label are the session labels. Labels map[string]string `json:"labels,omitempty"` // Paused indicates whether or not the session is paused. Paused bool `json:"paused"` - // State stores state fields relevant to running sessions. It is non-nil if - // and only if the session is unpaused. - *State + // SessionState stores state fields relevant to running sessions. It is + // non-nil if and only if the session is unpaused. + *SessionState } -// EndpointState encodes the current state of a synchronization endpoint. -type EndpointState struct { - // Connected indicates whether or not the controller is currently connected - // to the endpoint. - Connected bool `json:"connected"` - // Scanned indicates whether or not at least one scan has been performed on - // the endpoint. - Scanned bool `json:"scanned"` - // DirectoryCount is the number of synchronizable directory entries - // contained in the last snapshot from the endpoint. - DirectoryCount uint64 `json:"directoryCount,omitempty"` - // FileCount is the number of synchronizable file entries contained in the - // last snapshot from the endpoint. - FileCount uint64 `json:"fileCount,omitempty"` - // SymbolicLinkCount is the number of synchronizable symbolic link entries - // contained in the last snapshot from the endpoint. - SymbolicLinkCount uint64 `json:"symbolicLinkCount,omitempty"` - // TotalFileSize is the total size of all synchronizable files referenced by - // the last snapshot from the endpoint. - TotalFileSize uint64 `json:"totalFileSize,omitempty"` - // ScanProblems is the list of non-terminal problems encountered during the - // last scanning operation on the endpoint. This list may be a truncated - // version of the full list if too many problems are encountered to report - // via the API, in which case ExcludedScanProblems will be non-zero. - ScanProblems []Problem `json:"scanProblems,omitempty"` - // ExcludedScanProblems is the number of problems that have been excluded - // from ScanProblems due to truncation. This value can be non-zero only if - // ScanProblems is non-empty. - ExcludedScanProblems uint64 `json:"excludedScanProblems,omitempty"` - // TransitionProblems is the list of non-terminal problems encountered - // during the last transition operation on the endpoint. This list may be a - // truncated version of the full list if too many problems are encountered - // to report via the API, in which case ExcludedTransitionProblems will be - // non-zero. - TransitionProblems []Problem `json:"transitionProblems,omitempty"` - // ExcludedTransitionProblems is the number of problems that have been - // excluded from TransitionProblems due to truncation. This value can be - // non-zero only if TransitionProblems is non-empty. - ExcludedTransitionProblems uint64 `json:"excludedTransitionProblems,omitempty"` - // StagingProgress is the rsync staging progress. It is non-nil if and only - // if the endpoint is currently staging files. - StagingProgress *ReceiverState `json:"stagingProgress,omitempty"` -} - -// State encodes fields relevant to unpaused sessions. -type State struct { +// SessionState encodes fields relevant to unpaused sessions. +type SessionState struct { // Status is the session status. Status synchronization.Status `json:"status"` // LastError is the last synchronization error to occur. @@ -99,10 +51,6 @@ type State struct { // Conflicts due to truncation. This value can only be non-zero if conflicts // is non-empty. ExcludedConflicts uint64 `json:"excludedConflicts,omitempty"` - // AlphaState encodes the state of the alpha endpoint. - AlphaState EndpointState `json:"alphaState"` - // BetaState encodes the state of the beta endpoint. - BetaState EndpointState `json:"betaState"` } // loadFromInternal sets a session to match an internal Protocol Buffers session @@ -122,50 +70,30 @@ func (s *Session) loadFromInternal(state *synchronization.State) { s.Paused = state.Session.Paused // Propagate endpoint information. - s.Alpha.loadFromInternal(state.Session.Alpha) - s.Beta.loadFromInternal(state.Session.Beta) + s.Alpha.loadFromInternal( + state.Session.Alpha, + state.Session.ConfigurationAlpha, + state.AlphaState, + ) + s.Beta.loadFromInternal( + state.Session.Beta, + state.Session.ConfigurationBeta, + state.BetaState, + ) // Propagate configuration information. s.Configuration.loadFromInternal(state.Session.Configuration) - s.ConfigurationAlpha.loadFromInternal(state.Session.ConfigurationAlpha) - s.ConfigurationBeta.loadFromInternal(state.Session.ConfigurationBeta) // Propagate state information if the session isn't paused. if state.Session.Paused { - s.State = nil + s.SessionState = nil } else { - s.State = &State{ + s.SessionState = &SessionState{ Status: state.Status, LastError: state.LastError, SuccessfulCycles: state.SuccessfulCycles, Conflicts: exportConflicts(state.Conflicts), ExcludedConflicts: state.ExcludedConflicts, - AlphaState: EndpointState{ - Connected: state.AlphaState.Connected, - Scanned: state.AlphaState.Scanned, - DirectoryCount: state.AlphaState.DirectoryCount, - FileCount: state.AlphaState.FileCount, - SymbolicLinkCount: state.AlphaState.SymbolicLinkCount, - TotalFileSize: state.AlphaState.TotalFileSize, - ScanProblems: exportProblems(state.AlphaState.ScanProblems), - ExcludedScanProblems: state.AlphaState.ExcludedScanProblems, - TransitionProblems: exportProblems(state.AlphaState.TransitionProblems), - ExcludedTransitionProblems: state.AlphaState.ExcludedTransitionProblems, - StagingProgress: newReceiverStateFromInternalReceiverState(state.AlphaState.StagingProgress), - }, - BetaState: EndpointState{ - Connected: state.BetaState.Connected, - Scanned: state.BetaState.Scanned, - DirectoryCount: state.BetaState.DirectoryCount, - FileCount: state.BetaState.FileCount, - SymbolicLinkCount: state.BetaState.SymbolicLinkCount, - TotalFileSize: state.BetaState.TotalFileSize, - ScanProblems: exportProblems(state.BetaState.ScanProblems), - ExcludedScanProblems: state.BetaState.ExcludedScanProblems, - TransitionProblems: exportProblems(state.BetaState.TransitionProblems), - ExcludedTransitionProblems: state.BetaState.ExcludedTransitionProblems, - StagingProgress: newReceiverStateFromInternalReceiverState(state.BetaState.StagingProgress), - }, } } } diff --git a/pkg/api/models/synchronization/url.go b/pkg/api/models/synchronization/url.go deleted file mode 100644 index b131ff82..00000000 --- a/pkg/api/models/synchronization/url.go +++ /dev/null @@ -1,35 +0,0 @@ -package synchronization - -import ( - "github.com/mutagen-io/mutagen/pkg/url" -) - -// URL represents synchronization endpoint URL. -type URL struct { - // Protocol endpoint transport protocol. - Protocol url.Protocol `json:"protocol"` - // User is the endpoint user. - User string `json:"user,omitempty"` - // Host is the endpoint host. - Host string `json:"host,omitempty"` - // Port is the endpoint port. - Port uint16 `json:"port,omitempty"` - // Path is the synchronization root on the endpoint. - Path string `json:"path,omitempty"` - // Environment is the environment variable map to use for the transport. - Environment map[string]string `json:"environment,omitempty"` - // Parameters is the parameter map to use for the transport. - Parameters map[string]string `json:"parameters,omitempty"` -} - -// loadFromInternal sets a URL to match an internal Protocol Buffers -// representation. The URL must be a valid synchronization URL. -func (u *URL) loadFromInternal(url *url.URL) { - u.Protocol = url.Protocol - u.User = url.User - u.Host = url.Host - u.Port = uint16(url.Port) - u.Path = url.Path - u.Environment = url.Environment - u.Parameters = url.Parameters -} From 8086ea1e9f87c8c42e1e67ec6a72b262e22d5d3b Mon Sep 17 00:00:00 2001 From: Jacob Howard Date: Tue, 28 Jun 2022 10:48:59 -0600 Subject: [PATCH 2/2] sync: renamed directory, file, and symbolic link count fields The names of these fields weren't consistent with the naming convention for other counting fields. Signed-off-by: Jacob Howard --- cmd/mutagen/sync/list_monitor_common.go | 10 +- cmd/mutagen/sync/monitor.go | 4 +- pkg/api/models/synchronization/endpoint.go | 22 +-- pkg/synchronization/controller.go | 12 +- pkg/synchronization/core/scan.go | 31 ++-- pkg/synchronization/core/scan_test.go | 48 +++--- pkg/synchronization/core/snapshot.pb.go | 56 ++++--- pkg/synchronization/core/snapshot.proto | 14 +- pkg/synchronization/state.pb.go | 177 ++++++++++----------- pkg/synchronization/state.proto | 16 +- tools/scan_bench/main.go | 6 +- 11 files changed, 196 insertions(+), 200 deletions(-) diff --git a/cmd/mutagen/sync/list_monitor_common.go b/cmd/mutagen/sync/list_monitor_common.go index 1b0e242a..71883b21 100644 --- a/cmd/mutagen/sync/list_monitor_common.go +++ b/cmd/mutagen/sync/list_monitor_common.go @@ -180,9 +180,9 @@ func printEndpoint(name string, url *url.URL, configuration *synchronization.Con // Print content information, if available. if state.Scanned { fmt.Printf("\tSynchronizable contents:\n\t\t%s\n\t\t%s\n\t\t%s\n", - formatDirectoryCount(state.DirectoryCount), - formatFileCountAndSize(state.FileCount, state.TotalFileSize), - formatSymbolicLinkCount(state.SymbolicLinkCount), + formatDirectoryCount(state.Directories), + formatFileCountAndSize(state.Files, state.TotalFileSize), + formatSymbolicLinkCount(state.SymbolicLinks), ) } @@ -429,12 +429,12 @@ func printSession(state *synchronization.State, mode common.SessionDisplayMode) var totalExpectedSize uint64 if state.Status == synchronization.Status_StagingAlpha { stagingProgress = state.AlphaState.StagingProgress - if stagingProgress != nil && stagingProgress.ExpectedFiles == state.BetaState.FileCount { + if stagingProgress != nil && stagingProgress.ExpectedFiles == state.BetaState.Files { totalExpectedSize = state.BetaState.TotalFileSize } } else if state.Status == synchronization.Status_StagingBeta { stagingProgress = state.BetaState.StagingProgress - if stagingProgress != nil && stagingProgress.ExpectedFiles == state.AlphaState.FileCount { + if stagingProgress != nil && stagingProgress.ExpectedFiles == state.AlphaState.Files { totalExpectedSize = state.AlphaState.TotalFileSize } } diff --git a/cmd/mutagen/sync/monitor.go b/cmd/mutagen/sync/monitor.go index d7678090..1df61f94 100644 --- a/cmd/mutagen/sync/monitor.go +++ b/cmd/mutagen/sync/monitor.go @@ -68,7 +68,7 @@ func computeMonitorStatusLine(state *synchronization.State) string { stagingProgress = state.AlphaState.StagingProgress if stagingProgress == nil { status += "Preparing to stage files on alpha" - } else if stagingProgress.ExpectedFiles == state.BetaState.FileCount { + } else if stagingProgress.ExpectedFiles == state.BetaState.Files { totalExpectedSize = state.BetaState.TotalFileSize } } else if state.Status == synchronization.Status_StagingBeta { @@ -76,7 +76,7 @@ func computeMonitorStatusLine(state *synchronization.State) string { stagingProgress = state.BetaState.StagingProgress if stagingProgress == nil { status += "Preparing to stage files on beta" - } else if stagingProgress.ExpectedFiles == state.AlphaState.FileCount { + } else if stagingProgress.ExpectedFiles == state.AlphaState.Files { totalExpectedSize = state.AlphaState.TotalFileSize } } else { diff --git a/pkg/api/models/synchronization/endpoint.go b/pkg/api/models/synchronization/endpoint.go index 6d49b58b..d7fea5f7 100644 --- a/pkg/api/models/synchronization/endpoint.go +++ b/pkg/api/models/synchronization/endpoint.go @@ -36,15 +36,15 @@ type EndpointState struct { // Scanned indicates whether or not at least one scan has been performed on // the endpoint. Scanned bool `json:"scanned"` - // DirectoryCount is the number of synchronizable directory entries + // Directories is the number of synchronizable directory entries contained + // in the last snapshot from the endpoint. + Directories uint64 `json:"directories,omitempty"` + // Files is the number of synchronizable file entries contained in the last + // snapshot from the endpoint. + Files uint64 `json:"files,omitempty"` + // SymbolicLinks is the number of synchronizable symbolic link entries // contained in the last snapshot from the endpoint. - DirectoryCount uint64 `json:"directoryCount,omitempty"` - // FileCount is the number of synchronizable file entries contained in the - // last snapshot from the endpoint. - FileCount uint64 `json:"fileCount,omitempty"` - // SymbolicLinkCount is the number of synchronizable symbolic link entries - // contained in the last snapshot from the endpoint. - SymbolicLinkCount uint64 `json:"symbolicLinkCount,omitempty"` + SymbolicLinks uint64 `json:"symbolicLinks,omitempty"` // TotalFileSize is the total size of all synchronizable files referenced by // the last snapshot from the endpoint. TotalFileSize uint64 `json:"totalFileSize,omitempty"` @@ -96,9 +96,9 @@ func (e *Endpoint) loadFromInternal(url *url.URL, configuration *synchronization } else { e.EndpointState = &EndpointState{ Scanned: state.Scanned, - DirectoryCount: state.DirectoryCount, - FileCount: state.FileCount, - SymbolicLinkCount: state.SymbolicLinkCount, + Directories: state.Directories, + Files: state.Files, + SymbolicLinks: state.SymbolicLinks, TotalFileSize: state.TotalFileSize, ScanProblems: exportProblems(state.ScanProblems), ExcludedScanProblems: state.ExcludedScanProblems, diff --git a/pkg/synchronization/controller.go b/pkg/synchronization/controller.go index 9ebb99c0..f87d302d 100644 --- a/pkg/synchronization/controller.go +++ b/pkg/synchronization/controller.go @@ -1110,15 +1110,15 @@ func (c *controller) synchronize(ctx context.Context, alpha, beta Endpoint) erro c.stateLock.Lock() c.state.LastError = "" c.state.AlphaState.Scanned = true - c.state.AlphaState.DirectoryCount = αSnapshot.DirectoryCount - c.state.AlphaState.FileCount = αSnapshot.FileCount - c.state.AlphaState.SymbolicLinkCount = αSnapshot.SymbolicLinkCount + c.state.AlphaState.Directories = αSnapshot.Directories + c.state.AlphaState.Files = αSnapshot.Files + c.state.AlphaState.SymbolicLinks = αSnapshot.SymbolicLinks c.state.AlphaState.TotalFileSize = αSnapshot.TotalFileSize c.state.AlphaState.ScanProblems = αContent.Problems() c.state.BetaState.Scanned = true - c.state.BetaState.DirectoryCount = βSnapshot.DirectoryCount - c.state.BetaState.FileCount = βSnapshot.FileCount - c.state.BetaState.SymbolicLinkCount = βSnapshot.SymbolicLinkCount + c.state.BetaState.Directories = βSnapshot.Directories + c.state.BetaState.Files = βSnapshot.Files + c.state.BetaState.SymbolicLinks = βSnapshot.SymbolicLinks c.state.BetaState.TotalFileSize = βSnapshot.TotalFileSize c.state.BetaState.ScanProblems = βContent.Problems() c.state.Status = Status_Reconciling diff --git a/pkg/synchronization/core/scan.go b/pkg/synchronization/core/scan.go index fde09728..02ca0da3 100644 --- a/pkg/synchronization/core/scan.go +++ b/pkg/synchronization/core/scan.go @@ -123,13 +123,12 @@ type scanner struct { // preservesExecutability indicates whether or not the synchronization root // filesystem preserves POSIX executability bits. preservesExecutability bool - // directoryCount is the number of synchronizable directories encountered. - directoryCount uint64 - // fileCount is the number of synchronizable files encountered. - fileCount uint64 - // symbolicLinkCount is the number of synchronizable symbolic links - // encountered. - symbolicLinkCount uint64 + // directories is the number of synchronizable directories encountered. + directories uint64 + // files is the number of synchronizable files encountered. + files uint64 + // symbolicLinks is the number of synchronizable symbolic links encountered. + symbolicLinks uint64 // totalFileSize is the total size of all synchronizable files encountered. totalFileSize uint64 } @@ -243,7 +242,7 @@ func (s *scanner) file( } // Increment the total file count and size. - s.fileCount++ + s.files++ s.totalFileSize += metadata.Size // Success. @@ -291,7 +290,7 @@ func (s *scanner) symbolicLink( } // Increment the total symbolic link count. - s.symbolicLinkCount++ + s.symbolicLinks++ // Success. return &Entry{ @@ -460,11 +459,11 @@ func (s *scanner) directory( contentBaseline.walk(contentPath, func(path string, entry *Entry) { // Update total entry counts. if entry.Kind == EntryKind_Directory { - s.directoryCount++ + s.directories++ } else if entry.Kind == EntryKind_File { - s.fileCount++ + s.files++ } else if entry.Kind == EntryKind_SymbolicLink { - s.symbolicLinkCount++ + s.symbolicLinks++ } // Generate ignore cache entries. This isn't exhaustive, @@ -536,7 +535,7 @@ func (s *scanner) directory( } // Increment the total directory count. - s.directoryCount++ + s.directories++ // Success. return &Entry{ @@ -799,9 +798,9 @@ func Scan( Content: content, PreservesExecutability: preservesExecutability, DecomposesUnicode: decomposesUnicode, - DirectoryCount: s.directoryCount, - FileCount: s.fileCount, - SymbolicLinkCount: s.symbolicLinkCount, + Directories: s.directories, + Files: s.files, + SymbolicLinks: s.symbolicLinks, TotalFileSize: s.totalFileSize, }, newCache, newIgnoreCache, nil } diff --git a/pkg/synchronization/core/scan_test.go b/pkg/synchronization/core/scan_test.go index 20af1c40..3b1fe11b 100644 --- a/pkg/synchronization/core/scan_test.go +++ b/pkg/synchronization/core/scan_test.go @@ -514,22 +514,22 @@ func TestScan(t *testing.T) { test.description, filesystem.name, ) } - if snapshot.DirectoryCount != directoryCount { + if snapshot.Directories != directoryCount { t.Errorf("%s: cold scan directory count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - snapshot.DirectoryCount, directoryCount, + snapshot.Directories, directoryCount, ) } - if snapshot.FileCount != fileCount { + if snapshot.Files != fileCount { t.Errorf("%s: cold scan file count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - snapshot.FileCount, fileCount, + snapshot.Files, fileCount, ) } - if snapshot.SymbolicLinkCount != symbolicLinkCount { + if snapshot.SymbolicLinks != symbolicLinkCount { t.Errorf("%s: cold scan symbolic link count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - snapshot.SymbolicLinkCount, symbolicLinkCount, + snapshot.SymbolicLinks, symbolicLinkCount, ) } if snapshot.TotalFileSize != totalFileSize { @@ -593,22 +593,22 @@ func TestScan(t *testing.T) { test.description, filesystem.name, ) } - if newSnapshot.DirectoryCount != directoryCount { + if newSnapshot.Directories != directoryCount { t.Errorf("%s: warm scan directory count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - newSnapshot.DirectoryCount, directoryCount, + newSnapshot.Directories, directoryCount, ) } - if newSnapshot.FileCount != fileCount { + if newSnapshot.Files != fileCount { t.Errorf("%s: warm scan file count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - newSnapshot.FileCount, fileCount, + newSnapshot.Files, fileCount, ) } - if newSnapshot.SymbolicLinkCount != symbolicLinkCount { + if newSnapshot.SymbolicLinks != symbolicLinkCount { t.Errorf("%s: warm scan symbolic link count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - newSnapshot.SymbolicLinkCount, symbolicLinkCount, + newSnapshot.SymbolicLinks, symbolicLinkCount, ) } if newSnapshot.TotalFileSize != totalFileSize { @@ -664,22 +664,22 @@ func TestScan(t *testing.T) { test.description, filesystem.name, ) } - if newSnapshot.DirectoryCount != directoryCount { + if newSnapshot.Directories != directoryCount { t.Errorf("%s: accelerated scan (without re-check paths) directory count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - newSnapshot.DirectoryCount, directoryCount, + newSnapshot.Directories, directoryCount, ) } - if newSnapshot.FileCount != fileCount { + if newSnapshot.Files != fileCount { t.Errorf("%s: accelerated scan (without re-check paths) file count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - newSnapshot.FileCount, fileCount, + newSnapshot.Files, fileCount, ) } - if newSnapshot.SymbolicLinkCount != symbolicLinkCount { + if newSnapshot.SymbolicLinks != symbolicLinkCount { t.Errorf("%s: accelerated scan (without re-check paths) symbolic link count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - newSnapshot.SymbolicLinkCount, symbolicLinkCount, + newSnapshot.SymbolicLinks, symbolicLinkCount, ) } if newSnapshot.TotalFileSize != totalFileSize { @@ -781,22 +781,22 @@ func TestScan(t *testing.T) { test.description, filesystem.name, ) } - if newSnapshot.DirectoryCount != directoryCount { + if newSnapshot.Directories != directoryCount { t.Errorf("%s: accelerated scan (with re-check path(s)) directory count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - newSnapshot.DirectoryCount, directoryCount, + newSnapshot.Directories, directoryCount, ) } - if newSnapshot.FileCount != fileCount { + if newSnapshot.Files != fileCount { t.Errorf("%s: accelerated scan (with re-check path(s)) file count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - newSnapshot.FileCount, fileCount, + newSnapshot.Files, fileCount, ) } - if newSnapshot.SymbolicLinkCount != symbolicLinkCount { + if newSnapshot.SymbolicLinks != symbolicLinkCount { t.Errorf("%s: accelerated scan (with re-check path(s)) symbolic link count not equal to expected on %s filesystem: %d != %d", test.description, filesystem.name, - newSnapshot.SymbolicLinkCount, symbolicLinkCount, + newSnapshot.SymbolicLinks, symbolicLinkCount, ) } if newSnapshot.TotalFileSize != totalFileSize { diff --git a/pkg/synchronization/core/snapshot.pb.go b/pkg/synchronization/core/snapshot.pb.go index 6e59683a..f27dab5c 100644 --- a/pkg/synchronization/core/snapshot.pb.go +++ b/pkg/synchronization/core/snapshot.pb.go @@ -36,15 +36,15 @@ type Snapshot struct { // DecomposesUnicode indicates whether or not the associated filesystem // decomposes Unicode names. DecomposesUnicode bool `protobuf:"varint,3,opt,name=decomposesUnicode,proto3" json:"decomposesUnicode,omitempty"` - // DirectoryCount is the number of synchronizable directory entries - // contained in the snapshot. - DirectoryCount uint64 `protobuf:"varint,4,opt,name=directoryCount,proto3" json:"directoryCount,omitempty"` - // FileCount is the number of synchronizable file entries contained in the + // Directories is the number of synchronizable directory entries contained + // in the snapshot. + Directories uint64 `protobuf:"varint,4,opt,name=directories,proto3" json:"directories,omitempty"` + // Files is the number of synchronizable file entries contained in the // snapshot. - FileCount uint64 `protobuf:"varint,5,opt,name=fileCount,proto3" json:"fileCount,omitempty"` - // SymbolicLinkCount is the number of synchronizable symbolic link entries + Files uint64 `protobuf:"varint,5,opt,name=files,proto3" json:"files,omitempty"` + // SymbolicLinks is the number of synchronizable symbolic link entries // contained in the snapshot. - SymbolicLinkCount uint64 `protobuf:"varint,6,opt,name=symbolicLinkCount,proto3" json:"symbolicLinkCount,omitempty"` + SymbolicLinks uint64 `protobuf:"varint,6,opt,name=symbolicLinks,proto3" json:"symbolicLinks,omitempty"` // TotalFileSize is the total size of all synchronizable files referenced by // the snapshot. TotalFileSize uint64 `protobuf:"varint,7,opt,name=totalFileSize,proto3" json:"totalFileSize,omitempty"` @@ -103,23 +103,23 @@ func (x *Snapshot) GetDecomposesUnicode() bool { return false } -func (x *Snapshot) GetDirectoryCount() uint64 { +func (x *Snapshot) GetDirectories() uint64 { if x != nil { - return x.DirectoryCount + return x.Directories } return 0 } -func (x *Snapshot) GetFileCount() uint64 { +func (x *Snapshot) GetFiles() uint64 { if x != nil { - return x.FileCount + return x.Files } return 0 } -func (x *Snapshot) GetSymbolicLinkCount() uint64 { +func (x *Snapshot) GetSymbolicLinks() uint64 { if x != nil { - return x.SymbolicLinkCount + return x.SymbolicLinks } return 0 } @@ -138,7 +138,7 @@ var file_synchronization_core_snapshot_proto_rawDesc = []byte{ 0x6e, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x72, 0x65, 0x1a, 0x20, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x72, - 0x65, 0x2f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb1, 0x02, + 0x65, 0x2f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9b, 0x02, 0x0a, 0x08, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x25, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, @@ -148,21 +148,19 @@ var file_synchronization_core_snapshot_proto_rawDesc = []byte{ 0x75, 0x74, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x11, 0x64, 0x65, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x73, 0x55, 0x6e, 0x69, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x64, 0x65, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x73, - 0x55, 0x6e, 0x69, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x1c, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, - 0x11, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, - 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x74, - 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, - 0x65, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6d, 0x75, 0x74, 0x61, 0x67, 0x65, 0x6e, 0x2d, 0x69, 0x6f, 0x2f, 0x6d, 0x75, 0x74, 0x61, 0x67, - 0x65, 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, - 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x55, 0x6e, 0x69, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x6c, + 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x12, + 0x24, 0x0a, 0x0d, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x73, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x69, 0x63, + 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x42, 0x38, 0x5a, 0x36, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x75, 0x74, 0x61, 0x67, 0x65, + 0x6e, 0x2d, 0x69, 0x6f, 0x2f, 0x6d, 0x75, 0x74, 0x61, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/synchronization/core/snapshot.proto b/pkg/synchronization/core/snapshot.proto index f59ed352..e148a451 100644 --- a/pkg/synchronization/core/snapshot.proto +++ b/pkg/synchronization/core/snapshot.proto @@ -18,15 +18,15 @@ message Snapshot { // DecomposesUnicode indicates whether or not the associated filesystem // decomposes Unicode names. bool decomposesUnicode = 3; - // DirectoryCount is the number of synchronizable directory entries - // contained in the snapshot. - uint64 directoryCount = 4; - // FileCount is the number of synchronizable file entries contained in the + // Directories is the number of synchronizable directory entries contained + // in the snapshot. + uint64 directories = 4; + // Files is the number of synchronizable file entries contained in the // snapshot. - uint64 fileCount = 5; - // SymbolicLinkCount is the number of synchronizable symbolic link entries + uint64 files = 5; + // SymbolicLinks is the number of synchronizable symbolic link entries // contained in the snapshot. - uint64 symbolicLinkCount = 6; + uint64 symbolicLinks = 6; // TotalFileSize is the total size of all synchronizable files referenced by // the snapshot. uint64 totalFileSize = 7; diff --git a/pkg/synchronization/state.pb.go b/pkg/synchronization/state.pb.go index 5708bef1..e7e9a83a 100644 --- a/pkg/synchronization/state.pb.go +++ b/pkg/synchronization/state.pb.go @@ -146,15 +146,15 @@ type EndpointState struct { // Scanned indicates whether or not at least one scan has been performed on // the endpoint. Scanned bool `protobuf:"varint,2,opt,name=scanned,proto3" json:"scanned,omitempty"` - // DirectoryCount is the number of synchronizable directory entries + // Directories is the number of synchronizable directory entries contained + // in the last snapshot from the endpoint. + Directories uint64 `protobuf:"varint,3,opt,name=directories,proto3" json:"directories,omitempty"` + // Files is the number of synchronizable file entries contained in the last + // snapshot from the endpoint. + Files uint64 `protobuf:"varint,4,opt,name=files,proto3" json:"files,omitempty"` + // SymbolicLinks is the number of synchronizable symbolic link entries // contained in the last snapshot from the endpoint. - DirectoryCount uint64 `protobuf:"varint,3,opt,name=directoryCount,proto3" json:"directoryCount,omitempty"` - // FileCount is the number of synchronizable file entries contained in the - // last snapshot from the endpoint. - FileCount uint64 `protobuf:"varint,4,opt,name=fileCount,proto3" json:"fileCount,omitempty"` - // SymbolicLinkCount is the number of synchronizable symbolic link entries - // contained in the last snapshot from the endpoint. - SymbolicLinkCount uint64 `protobuf:"varint,5,opt,name=symbolicLinkCount,proto3" json:"symbolicLinkCount,omitempty"` + SymbolicLinks uint64 `protobuf:"varint,5,opt,name=symbolicLinks,proto3" json:"symbolicLinks,omitempty"` // TotalFileSize is the total size of all synchronizable files referenced by // the last snapshot from the endpoint. TotalFileSize uint64 `protobuf:"varint,6,opt,name=totalFileSize,proto3" json:"totalFileSize,omitempty"` @@ -228,23 +228,23 @@ func (x *EndpointState) GetScanned() bool { return false } -func (x *EndpointState) GetDirectoryCount() uint64 { +func (x *EndpointState) GetDirectories() uint64 { if x != nil { - return x.DirectoryCount + return x.Directories } return 0 } -func (x *EndpointState) GetFileCount() uint64 { +func (x *EndpointState) GetFiles() uint64 { if x != nil { - return x.FileCount + return x.Files } return 0 } -func (x *EndpointState) GetSymbolicLinkCount() uint64 { +func (x *EndpointState) GetSymbolicLinks() uint64 { if x != nil { - return x.SymbolicLinkCount + return x.SymbolicLinks } return 0 } @@ -428,86 +428,85 @@ var file_synchronization_state_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x04, 0x0a, 0x0d, + 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf1, 0x03, 0x0a, 0x0d, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x63, - 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x64, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, - 0x09, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x11, 0x73, - 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x69, 0x63, - 0x4c, 0x69, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x6f, 0x74, - 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, - 0x31, 0x0a, 0x0c, 0x73, 0x63, 0x61, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, - 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x0c, 0x73, 0x63, 0x61, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, - 0x6d, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x53, 0x63, - 0x61, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x14, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x53, 0x63, 0x61, 0x6e, 0x50, 0x72, - 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x12, 0x3d, 0x0a, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, - 0x6d, 0x52, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, - 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x12, 0x3e, 0x0a, 0x1a, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, - 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, - 0x65, 0x6d, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x1a, 0x65, 0x78, 0x63, 0x6c, 0x75, - 0x64, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, - 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x12, 0x3e, 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67, - 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x72, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x52, 0x0f, 0x73, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, - 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, 0x90, 0x03, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x32, 0x0a, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x12, 0x2a, 0x0a, 0x10, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, - 0x43, 0x79, 0x63, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x73, 0x75, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x43, 0x79, 0x63, 0x6c, 0x65, 0x73, 0x12, 0x2c, - 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, - 0x74, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x11, - 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, - 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x3e, 0x0a, 0x0a, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x62, 0x65, - 0x74, 0x61, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x24, 0x0a, + 0x0d, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x69, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x69, 0x63, 0x4c, 0x69, + 0x6e, 0x6b, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x73, 0x63, 0x61, + 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x0c, + 0x73, 0x63, 0x61, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x12, 0x32, 0x0a, 0x14, + 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x53, 0x63, 0x61, 0x6e, 0x50, 0x72, 0x6f, 0x62, + 0x6c, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x65, 0x78, 0x63, 0x6c, + 0x75, 0x64, 0x65, 0x64, 0x53, 0x63, 0x61, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, + 0x12, 0x3d, 0x0a, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, + 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, + 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x12, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x12, + 0x3e, 0x0a, 0x1a, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x1a, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x12, + 0x3e, 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x72, 0x73, 0x79, 0x6e, 0x63, + 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0f, + 0x73, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, + 0x90, 0x03, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x79, 0x6e, + 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x62, - 0x65, 0x74, 0x61, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2a, 0x97, 0x02, 0x0a, 0x06, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x48, 0x61, 0x6c, 0x74, 0x65, 0x64, 0x4f, - 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x45, 0x6d, 0x70, 0x74, 0x69, 0x65, 0x64, 0x10, 0x01, 0x12, 0x18, - 0x0a, 0x14, 0x48, 0x61, 0x6c, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x48, 0x61, 0x6c, 0x74, - 0x65, 0x64, 0x4f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, - 0x67, 0x65, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6e, 0x67, 0x41, 0x6c, 0x70, 0x68, 0x61, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x65, 0x74, 0x61, 0x10, 0x05, 0x12, 0x0c, 0x0a, - 0x08, 0x57, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x10, 0x06, 0x12, 0x0c, 0x0a, 0x08, 0x53, - 0x63, 0x61, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x07, 0x12, 0x14, 0x0a, 0x10, 0x57, 0x61, 0x69, - 0x74, 0x69, 0x6e, 0x67, 0x46, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x63, 0x61, 0x6e, 0x10, 0x08, 0x12, - 0x0f, 0x0a, 0x0b, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x10, 0x09, - 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x41, 0x6c, 0x70, 0x68, 0x61, - 0x10, 0x0a, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x42, 0x65, 0x74, - 0x61, 0x10, 0x0b, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x0c, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x61, 0x76, 0x69, 0x6e, 0x67, - 0x10, 0x0d, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6d, 0x75, 0x74, 0x61, 0x67, 0x65, 0x6e, 0x2d, 0x69, 0x6f, 0x2f, 0x6d, 0x75, 0x74, 0x61, - 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, + 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2a, 0x0a, 0x10, + 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x43, 0x79, 0x63, 0x6c, 0x65, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, + 0x75, 0x6c, 0x43, 0x79, 0x63, 0x6c, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x66, + 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, + 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x52, 0x09, 0x63, 0x6f, 0x6e, + 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, + 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, + 0x69, 0x63, 0x74, 0x73, 0x12, 0x3e, 0x0a, 0x0a, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x68, + 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x62, 0x65, 0x74, 0x61, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, + 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x62, 0x65, 0x74, 0x61, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x2a, 0x97, 0x02, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, 0x0a, + 0x0c, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x17, 0x0a, 0x13, 0x48, 0x61, 0x6c, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x45, + 0x6d, 0x70, 0x74, 0x69, 0x65, 0x64, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x48, 0x61, 0x6c, 0x74, + 0x65, 0x64, 0x4f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, + 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x48, 0x61, 0x6c, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x52, 0x6f, + 0x6f, 0x74, 0x54, 0x79, 0x70, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10, 0x03, 0x12, 0x13, + 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x6c, 0x70, 0x68, + 0x61, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, + 0x67, 0x42, 0x65, 0x74, 0x61, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x57, 0x61, 0x74, 0x63, 0x68, + 0x69, 0x6e, 0x67, 0x10, 0x06, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x63, 0x61, 0x6e, 0x6e, 0x69, 0x6e, + 0x67, 0x10, 0x07, 0x12, 0x14, 0x0a, 0x10, 0x57, 0x61, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x46, 0x6f, + 0x72, 0x52, 0x65, 0x73, 0x63, 0x61, 0x6e, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x65, 0x63, + 0x6f, 0x6e, 0x63, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x10, 0x09, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x74, + 0x61, 0x67, 0x69, 0x6e, 0x67, 0x41, 0x6c, 0x70, 0x68, 0x61, 0x10, 0x0a, 0x12, 0x0f, 0x0a, 0x0b, + 0x53, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x42, 0x65, 0x74, 0x61, 0x10, 0x0b, 0x12, 0x11, 0x0a, + 0x0d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x0c, + 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x61, 0x76, 0x69, 0x6e, 0x67, 0x10, 0x0d, 0x42, 0x33, 0x5a, 0x31, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x75, 0x74, 0x61, 0x67, + 0x65, 0x6e, 0x2d, 0x69, 0x6f, 0x2f, 0x6d, 0x75, 0x74, 0x61, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/synchronization/state.proto b/pkg/synchronization/state.proto index 18d560f8..96aa4f37 100644 --- a/pkg/synchronization/state.proto +++ b/pkg/synchronization/state.proto @@ -64,15 +64,15 @@ message EndpointState { // Scanned indicates whether or not at least one scan has been performed on // the endpoint. bool scanned = 2; - // DirectoryCount is the number of synchronizable directory entries + // Directories is the number of synchronizable directory entries contained + // in the last snapshot from the endpoint. + uint64 directories = 3; + // Files is the number of synchronizable file entries contained in the last + // snapshot from the endpoint. + uint64 files = 4; + // SymbolicLinks is the number of synchronizable symbolic link entries // contained in the last snapshot from the endpoint. - uint64 directoryCount = 3; - // FileCount is the number of synchronizable file entries contained in the - // last snapshot from the endpoint. - uint64 fileCount = 4; - // SymbolicLinkCount is the number of synchronizable symbolic link entries - // contained in the last snapshot from the endpoint. - uint64 symbolicLinkCount = 5; + uint64 symbolicLinks = 5; // TotalFileSize is the total size of all synchronizable files referenced by // the last snapshot from the endpoint. uint64 totalFileSize = 6; diff --git a/tools/scan_bench/main.go b/tools/scan_bench/main.go index 1937778b..5baecfc5 100644 --- a/tools/scan_bench/main.go +++ b/tools/scan_bench/main.go @@ -306,9 +306,9 @@ func main() { fmt.Println("Snapshot contained", entryCount, "entries") // Print snapshot statistics. - fmt.Println("Snapshot contained", snapshot.DirectoryCount, "directories") - fmt.Println("Snapshot contained", snapshot.FileCount, "files") - fmt.Println("Snapshot contained", snapshot.SymbolicLinkCount, "symbolic links") + fmt.Println("Snapshot contained", snapshot.Directories, "directories") + fmt.Println("Snapshot contained", snapshot.Files, "files") + fmt.Println("Snapshot contained", snapshot.SymbolicLinks, "symbolic links") fmt.Println("Snapshot files totaled", humanize.Bytes(snapshot.TotalFileSize)) // Perform a deep copy of the snapshot contents.