System and method for event-based synchronization of remote and local file systems

A method for synchronizing a file system (FS) and a remote file system (RFS) includes monitoring the FS for FS events, generating FS event records, receiving RFS event records of RFS events, generating file system operations (FSOs) based on the FS and RFS event records, and communicating the FSOs to the FS and RFS to synchronize them. A method for generating the FSOs includes accessing a plurality of FS and/or RFS event records, processing the accessed records to generate processed event records, generating the FSOs based on the processed event records, and outputting the FSOs to cause synchronization of the FS and RFS. Systems are also described. The invention facilitates event-based, steady-state synchronization of local and remote file systems.

BACKGROUND OF THE INVENTION

Field of the Invention

This invention relates generally to computer systems, and more particularly to cloud file storage systems. Even more particularly, this invention relates to synchronizing a local file system and a remote cloud file system stored remotely.

Description of the Background Art

Cloud computing systems are known. In cloud computing systems, computing and storage services are provided to remote clients over a wide area network such as the Internet. In the case of storage, a client's local files can be stored on the cloud and accessed by the client remotely.

Often a client's file system will exist both in the client's local storage device (e.g., a hard drive, network attached storage (NAS) device, etc.) and in the cloud. For example, a client might store a backup copy of its local file system in the cloud. Doing so is beneficial from the standpoint that the client has a backup copy of its file system. However, any benefit of the backup is negated as more and more changes are made to the local file system. Thus, it becomes a burden on the client to make sure the file system stored on the cloud is up to date. It is common for the file system on the cloud to be significantly older than the local file system, putting the local file system at risk if it is damaged.

In some cases, the client might also want to access its file system on the cloud. If changes to the cloud file system are made, then the cloud file system will become different from the local file system. As indicated above, problems arise when the local and cloud file systems become different.

What is needed, therefore, is a system and method that facilitates synchronizing a client's local file system with its file system on the cloud. What is also needed is a system and method that facilitates such synchronization in near real time. What is also needed is a system and method that facilitates such synchronization regardless of whether changes are made to the client's local file system or the associated cloud file system.

SUMMARY

The present invention overcomes the problems associated with the prior art by providing a system and method for event-based, steady-state synchronization of local and remote (cloud) file systems. The invention facilitates near-real-time synchronization and conflict resolution of remote and local file systems so that each of the remote and local file system are up-to-date. The synchronization is bidirectional and is carried out whether changes are made to the remote file system or to the local file system. Thus, clients can maintain local and remote access to up-to-date data.

A method for synchronizing a file system (FS) and a remote file system (RFS) that is located remotely from the FS is disclosed. The method includes monitoring the FS for FS events, where each of the FS events is indicative of a change made to the FS, and generating a plurality of event records based on the FS events. The method further includes receiving a plurality of RFS event records indicative of remote events that changed the RFS, generating file system operations (FSOs) based in part on the event records and RFS event records, and then communicating the file system operations to the FS and RFS to synchronize the FS and RFS. The RFS event records can be received, and the file system operations can be provided to the RFS, via a connection established with a remote file storage system having access to the RFS. Additionally, the generating step can optionally be initiated after each event record is generated or according to an (optionally adjustable) event synchronization time period. Event records and RFS event records associated with events occurring during the event synchronization period will be used to generate file system operations. Methods also include initially synchronizing the FS and RFS prior to the step of monitoring for events. Monitoring the FS for changes can include monitoring calls to the FS from the client, and executing a trap that causes an event record to be generated each time a call change the FS.

A particular method also includes processing the event records and RFS event records to generate a set of processed event records such that the step of generating FSO's is based at least in part on the set of processed event records. Processing events can include identifying by type and modifying at least some of the event records of that type. Processing events can also include deleting some of the event records (or RFS event records). Sometimes the step of processing events also includes accessing an FS event record and an RFS event record related to a file system object common to both the FS and RFS, and resolving an event conflict between the first event record and the second RFS event record.

The methods can also include storing (e.g., chronologically) the event records in a first events database and storing (e.g., chronologically) the RFS event records in a second events database. The event records and RFS event records can also be retrieved from their respective databases chronologically and/or according to the hierarchies of the FS and RFS, respectively. Prior to the step of generating file system operations, some of the event records and some of the RFS event records can be copied to third and fourth (view) databases, respectively.

Another method for synchronizing an FS and an RFS includes the steps of monitoring the FS for events, generating an event record in response to the occurrence of each event, optionally receiving a request for event records, and transmitting the event records to a remote file storage system having access to the RFS.

A file storage system for use with a remote file storage system is also disclosed. The file storage system includes memory storing a file system (FS) with FS objects, a client interface for providing client access, a file system module that monitors for changes being made to the FS by the client and outputs event information about the changes, and a data monitor that generates event records based on the event information from the file system module. The server also includes a remote file server interface for communicating with the remote system, a synchronizer that receives RFS event records from the remote system, an event processor that generates FSOs based on the event records and RFS event records, and an output that can communicate the FSOs to the FS and RFS to synchronize the FS and RFS. Optionally, the FS and RFS can be initially synchronized. The file system module can monitor I/O calls going to the FS and execute a trap for each of the I/O calls, which results in an event record being generated. The event processor can generate FSOs responsive to each event record being generated or according to an event synchronization time period described above. The synchronizer can be further operative to request RFS event records from the remote server via the remote file server interface. The system can also include a sync action handler operative to cause (e.g., via APIs) some of the FSOs to be applied to the FS and others of the FSOs to be transmitted to the RFS for application.

The system can also include a first and second events database that store (e.g., chronologically) FS and RFS event records, respectively. Additionally, the first and second event databases are operative to return FS event records and RFS event records chronologically and/or according to the hierarchies of the FS and RFS, respectively. The system can also include third and fourth (view) databases. The data monitor can copy some of the event records from the first database to the third database, and the synchronizer can copy some of the RFS event records from the second database to the fourth database. The event processor is then operative to generate the FSOs using only the FS and RFS event records stored in the third and fourth databases.

The event processor can also process the event records and RFS event records to generate a set of processed event records, e.g., before or as part of the FSO generation process. For example, the event processor can identify event records (and RFS event records) associated with particular types of events and modify some of the event records having that particular type. The event processor can also delete some of the event records. Furthermore, the event processor can identify conflicts between FS and RFS event records associated with a common file system object, and cause FSOs to be generated that resolve that conflict.

Another file storage system for use with a remote file storage system having access to an RFS is also disclosed. The file storage system includes memory storing a file system (FS) with FS objects, a client interface for providing client access to the FS, a file system module that monitors for changes being made to the FS by the client, and a data monitor that generates an event record responsive to a change being made to the FS. The system also includes a remote file server interface for establishing a connection with the remote file storage system and a synchronizer operative to transmit the event record to the remote file storage system via the remote file server interface.

Yet another file storage system according to the invention includes a local file storage system storing a local file system (LFS) and a remote file storage system storing an RFS. The system also includes a local event monitor on the local system that generates local event records indicative of changes made to the LFS and a remote event monitor on the remote system that generates remote event records indicative of changes made to the RFS. The system further includes an event processor on at least one of the local file storage system and the remote file storage system that is operative to use local and remote event records to synchronize the LFS and the RFS.

A method for generating file system operations for synchronizing the FS and RFS is also described herein. That method includes the steps of accessing a plurality of event records associated with changes previously made to the FS and the RFS, processing the event records to generate a set of processed event records, generating FSOs based at least in part on the set of processed event records, and outputting the FSOs to cause synchronization of the FS and the RFS. The step of processing the event records can include first, processing ones of the event records that are associated with the FS independently from ones of the event records that are associated with the RFS, and second, jointly processing the event records associated with the FS and the RFS.

In a particular method, the step of processing event records includes identifying ones of the event records according to a type of event and modifying at least some of the identified event records having that type. For example, for a rename event indicative of a path modification to a file system object (e.g., an object rename or move), the method includes accessing a first event record indicative of a first rename event and modifying a path associated with a second event record based on the first rename event. A timestamp of the second event record can also be modified. Another example includes identifying event records associated with folder deletions, accessing an event record indicative of a first folder being deleted, and deleting a second event record associated with the first folder.

As indicated above, the step of processing the event records can include deleting some of the event records. For example, the method can include the steps of identifying redundant event records associated with a file system object (e.g., a file or folder) and deleting the redundant event records. Identifying redundant events can include a step of comparing a later-occurring event record associated with the file system object with an earlier-occurring event record associated with the file system object. As another example, a particular FS event record and a particular RFS event records can be deleted if they both perform the same action (e.g., delete a file system object, create of a folder, etc.) in the FS and RFS.

Another particular method of processing the event records includes accessing a first event record associated with a first event occurring to a common file system object in the FS, accessing a second event record associated with a second event occurring to the common file system object in the RFS, and resolving a conflict between the first event and the second event (e.g., by generating FSOs using a lookup table, executing a different synchronization process, etc.). Still another particular method of processing the event records includes identifying ones of the event records that are associated with a particular file system object and using a look-up table to determine if at least one of the identified event records should be modified.

A server for generating file system operations for synchronizing an FS and an RFS is also disclosed. The server includes memory storing a plurality of event records associated with changes previously made to one of the FS and the RFS, an event processor operative to process the event records to generate a set of processed event records, an operations generator operative to generate FSOs based at least in part on the set of processed event records, and an output port operative to output the FSOs to cause synchronization of the FS and the RFS. In a particular embodiment, the event processor is operative to, first, process ones of the event records that are associated with the FS independently from ones of the event records that are associated with the RFS, and second, jointly process the event records associated with the FS and the RFS.

The event processor can process event records in various ways. For example, the event processor can identify ones of the event records based on the type of event and modify at least some of the identified event records having that type. One type is a rename event and the event processor can access a first event record indicative of a first rename event (an object rename or move) and modify a path (and optionally timestamp) associated with a second event record based on the first rename event. Another type is folder deletions. In such a case, the event processor can access a first event record indicative of a first folder being deleted and delete a second event record associated with the first folder.

The event processor can also delete some event records in other ways to generate the set of processed event records. For example, the event processor can identify and delete redundant event records occurring on a file system object (e.g., a file or folder). Redundant events can be identified by comparing chronological events occurring on the same file system path. The event processor can also delete an FS event record and an RFS event record that both indicate the same event (e.g., deleting the same object or creating the same folder) on both the FS and RFS.

The event processor also processes events by generating FSOs that resolve a conflict between an FS event and an RFS event occurring on a file system object common to both the FS and RFS. Lookup tables can be employed to determine the FSO(s) to resolve a conflict. In response to some event conflicts/errors, the event processor is operative to generate instructions to initiate a re-synchronization process of the FS and RFS. The event processor can also use the look up tables to determine which event records, each of which being associated with the same file system object, should be modified during event processing.

DETAILED DESCRIPTION

The present invention overcomes the problems associated with the prior art by providing a system and method for event-based, steady-state synchronization of local and remote (cloud) file systems. In the following description, numerous specific details are set forth (e.g., pseudo-code for functional modules, etc.) in order to provide a thorough understanding of the invention. Those skilled in the art will recognize, however, that the invention may be practiced apart from these specific details. In other instances, details of well-known computing practices and components and components have been omitted, so as not to unnecessarily obscure the present invention.

FIG. 1shows a cloud computing system100to include a remote cloud server102and a local cloud server104, which communicate and are synchronized via the Internet106. Local cloud104can be hosted, for example, by a file server in an office108and is, therefore, sometimes referred to as an office local cloud (OLC). Local clients110can access cloud files by directly accessing files/objects stored on local cloud104, via a local network112. Remote clients114can access cloud files by accessing files/objects stored on remote cloud102, via Internet106, or via some other connection116with cloud server102. The local cloud server104is bi-directionally synchronized with the remote cloud server102to provide local and remote data access and remote data security.

FIG. 2Aillustrates a snapshot-based method of synchronizing a remote file system (RFS)202stored on remote cloud102and a local file system (LFS)204stored on local cloud104. Synchronization is the process by which RFS202and LFS204can be made identical at a particular time, TS. In other words, RFS202and LFS204are considered synchronized when, as of a time TS, the same file system objects stored on LFS204are also stored on the RFS202.

The RFS202can be initially created and synchronized with the LFS204using a full file system scan (FFS) wherein the LFS204is initially copied to remote cloud102and stored as RFS202, for example, when an account is opened with a remote cloud service provider. Subsequently, the LFS204and the CFS202can be periodically synchronized using bi-directional snapshot-based synchronizations. For example, a full rescan sync (FRS) process can be used to “walk” the LFS204and the RFS202and create metadata snapshots of these file systems at a time TS. These snapshots can then be compared and the differences used to bi-directionally synchronize the two file systems. A limited rescan sync (LRS) is similar to the FRS, but is only based on partial metadata snapshots (e.g., snapshots for particular folders, etc.) of the two file systems. The snapshot-based synchronization method is more CPU and memory intensive and does not scale well for file systems with large namespaces.

FIG. 2Billustrates a steady-state, event-based synchronization method according the present invention. This method is based on monitoring and collecting all of the changes made to the LFS204by local clients110and to the RFS202by remote clients114from some point in time, T1. Changes made to the RFS202and to the LFS204are called remote events206and local events208, respectively. Then, at a later time T2, the remote events206and local events208are processed and appropriate file system operations are generated and applied to RFS202and LFS204to synchronize RFS202and LFS204as of time T2. The time period between T1and T2is called the event synchronization period.

The steady-state synchronization process ofFIG. 2Benables the RFS202and LFS204to remain synchronized in near real-time as the RFS202and LFS204are synchronized for consecutive event synchronization periods. The steady-state synchronization process is also easily scalable and uses resources more efficiently than relying solely on the snapshot-based methods ofFIG. 2A.

FIG. 3is a block diagram of remote cloud server102. Remote cloud server102includes a wide-area network adapter302, one or more processing units304, working memory306, one or more user interface devices308, a local network adapter310, a remote cloud services component312, and non-volatile memory314, all intercommunicating via an internal bus316. Processing units(s)304impart functionality to remote cloud server102by executing code stored in any or all of non-volatile memory314, working memory306, and remote cloud services312. Remote cloud services312represents hardware, software, firmware, or some combination thereof, that provides the synchronization functionality described herein.

Wide area network adapter302provides a means for remote cloud server102to communicate with remote clients114and local cloud104via Internet106. Local network adapter310provides a means for accessing a plurality of data storage devices322(1-n), via a private network320. Clients' files are stored in and retrieved from data storage devices322(1-n) as needed. Additional data storage devices322(n+) can be added as needed to provide additional storage capacity. In this example embodiment, data storage devices322(1-n) are network attached storage (NAS) devices, but any suitable type of storage device can be used.

Cloud-based object-storage infrastructures are further described in U.S. patent application Ser. No. 13/708,040, filed on Dec. 7, 2012 by Shetty et al. and entitled “System And Method Of Implementing An Object Storage Infrastructure For Cloud-Based Services”, which is incorporated herein by reference in its entirety. Furthermore, permission management frameworks for cloud servers is described in U.S. patent application Ser. No. 13/689,648, filed on Nov. 29, 2012 by Wijayaratne et al. and entitled “Flexible Permission Management Framework For Cloud Attached File Systems”, which is also incorporated herein by reference in its entirety.

FIG. 4is a relational diagram of the functional aspects of an architecture for synchronizing LFS204and RFS202, which is implemented within remote cloud server102. In the illustrated embodiment, the functional aspects are provided by remote cloud services312, but the functional elements of the system can be distributed across other service modules or even other machines.

Remote client114is a device and/or process used to access files in RFS202via an RFS handler402. Remote clients114can connect with RFS handler402either via the Internet106or via connections116(FIG. 1). RFS handler402represents an interface/protocol by which remote clients114can access and modify RFS202. For example, RFS handler402can be an interface implementing HTTP, WebDAV, and/or FTP protocols, an interface compatible with a mobile application (e.g., an application running on a smart telephone, tablet, etc.), or some other interface with which an application on the remote client114can interact. Responsive to a remote client114requesting access, file access interface402calls remote virtual file system (VFS) module404.

Remote VFS module404is a software plugin that provides remote client114with file and folder access to RFS202. Initially, it should be noted that RFS202includes both an RFS metadata database406and the associated data objects stored on data storage devices322(1-n). Metadata database406stores metadata (e.g., virtual files, virtual folders, permissions, etc.) that describes a hierarchical, virtual file system via which remote client114can access file system objects and make changes to RFS202. Data storage devices322(1-n) store data files that are associated with the virtual file system objects defined by the metadata. The metadata in database406stores paths to the associated data files on data storage devices322(1-n), so that file system objects can be accessed, updated, and created on devices322(1-n) in accordance with changes made by the remote client114to virtual RFS202.

Remote VFS module404intercepts the file system calls coming from remote client114and enforces cloud permissions on file system access. If access is permitted, remote VFS module404utilizes metadata stored in RFS metadata database406to provide remote client114with a hierarchical virtual file system (e.g., a directory tree view of folders and files) via which the remote client114can access and make changes to the file system objects. When a data file needs to be uploaded to, downloaded from, or deleted from client data storage devices322(1-n), remote VFS module404utilizes RFS object I/O module408to store the data file.

RFS object I/O module408manages the I/O subsystem for organized data file storage and access on data storage devices322(1-n). Responsive to VFS module404and metadata, RFS object I/O module408downloads associated data files from, uploads associated data files to, and deletes associated data files from data storage devices322(1-n). VFS module404provides data files to, and retrieves data files from, remote client114as needed via RFS handler402.

In other words, RFS202includes a control plane and a data plane. The control plane includes the metadata in RFS metadata database406, which the remote client114can change via the virtual file system. The data storage devices322(1-n) represents the data plane, which the remote client114does not have direct access to or control over. Rather, changes are propagated to the data plane based on changes that the client makes to the virtual file system.

Changes that are made to a file system are called “events”. Changes made to RFS202specifically are referred to as “remote events”, whereas changes made to LFS204will be referred to as local events. In the present embodiment, remote events originate as changes to the metadata stored in RFS metadata database406, for example, as a result of remote client114interacting with the virtual file system.

Events include file events and folder events. File events include creating a file (CREATE), updating a file (UPDATE), deleting a file (UNLINK), and renaming a path (RENAME). Because RENAME operates on the path, RENAME can represent both rename events and move events. Additionally, RENAME events are represented from both the source and destination path perspectives. Representing RENAME events in this manner facilitates event processing from both the source and the destination perspectives, as will be described in further detail below. Accordingly, file RENAME events from the source perspective is RENAME_SRC_FILE (RSF) and the file RENAME event from the destination perspective is RENAME_DST_FILE (RDF). Folder events include creating a folder (MKDIR), removing a folder (RMDIR), and renaming a folder. The rename event is represented from both the source perspective (RENAME_SRC_DIR, “RSD”) and from the destination perspective (RENAME_DST_DIR, “RDD”). These events will be described in greater detail below.

Remote VFS module404facilitates event-based synchronization of RFS202and LFS204by trapping the remote events as they occur (i.e., when changes are made to the virtual file system) and providing remote event information to a remote data monitor410. In particular, remote VFS module404monitors I/O requests from remote client114and provides remote event information to remote data monitor410when it receives an I/O request that changes the virtual file system.

For each remote event, remote data monitor410receives the remote event information from remote VFS module404, and then enters a record of the remote event in a remote event database412. Optionally, remote data monitor410can filter irrelevant and/or redundant remote events (e.g., by optionally implementing phase 0-1 processing described below, etc.) from database412. Additionally, remote data monitor410can notify a remote synchronizer416of the occurrence of remote events and can receive synchronization commands from remote synchronizer416. For example, responsive to a request for remote event records from remote synchronizer416, remote data monitor410can retrieve the requested remote event records from remote event database412(e.g., for an event sync period) and provide them to remote synchronizer416. Remote data monitor410can also periodically delete the remote event records from remote event database412, for example, following a command from remote synchronizer416following successful event synchronization.

Remote event database412provides storage for a plurality of remote event records associated with a plurality of remote events. These events are maintained according to a scalable relational database schema. Records of remote events are stored in remote event database412in chronological order. However, as will be described in further detail below, remote event database412can return event records chronologically and/or according to the hierarchy of the virtual file system.

Remote synchronizer416controls various aspects of the synchronization process between the remote cloud102and the local cloud104from the remote cloud side. For example, remote synchronizer416can receive commands from local cloud104, via internet106and a local cloud interface418, to initiate synchronization. In response, remote synchronizer416can request remote event records from RFS data monitor410, receive the remote event records, and provide the remote event records to local cloud104via local cloud interface418. In other embodiments, remote synchronizer416can periodically provide the remote event records to local cloud104without the events being requested by local cloud104. In still other embodiments, remote synchronizer416can contact local cloud104via interface418and initiate the synchronization process, for example, in response to remote synchronizer416receiving notification of a remote event from remote data monitor410.

Remote synchronizer416is also operative to receive file system operations for modifying RFS202from local cloud104via interface418and to provide those file system operations to RFS handler402. RFS handler402, in turn, causes the file system operations to be applied to RFS202. The file system operations represent changes associated with local events that are being applied to the RFS202as part of the bidirectional, steady-state synchronization process (FIG. 2B).

File system operations can include any file system operations that are recognized by the protocol(s) implemented by RFS handler402(e.g., upload, download, delete, move, create, rename, etc.). The file system operations make changes in RFS metadata database406and/or client data stores322(1-n) as part of the synchronization process. For example, the file system operations can cause a file or folder to be created, deleted, renamed, or moved in the metadata virtual file system. As another example, the file system operations can also result in a file being uploaded, downloaded, moved, renamed, or deleted from the client data stores322(1-n). File system operations will be discussed in further detail below.

As indicated above, remote synchronizer416communicates with local cloud interface418. Local cloud interface418is a means by which remote cloud server102can establish an internet connection with local cloud server104and intercommunicate as needed. In a particular embodiment, local cloud interface418maintains an open (always on) connection with local cloud104for efficient event-based synchronization.

FIG. 5is a block diagram showing local cloud server104in greater detail. In this particular embodiment, local cloud server104is an enhanced network attached storage (NAS) device that includes one or more processing units504, working memory506, one or more user interface devices508, a local network adapter510, a local cloud services component512, and non-volatile memory514, all intercommunicating via an internal bus516. Processing units(s)504impart functionality to local cloud server104by executing code stored in any or all of non-volatile memory514, working memory506, and local cloud services512. A wide-area network adapter518facilitates communication with remote cloud102(FIG. 1) via local network112and the Internet106.

Non-volatile memory514also provides local file storage for client files/objects. By way of example, the nonvolatile memory514is shown to include (in addition to other types of memory) a set of hard drives arranged in a RAID configuration. The client's file system on the RAID drives can be accessed by local clients110via local network112, as is known in the art.

Local cloud services512represents hardware, software, firmware, or some combination thereof, that provides the event-based synchronization functionality described herein. Local cloud services512also provide file storage and retrieval services to local clients110. The file storage functionality of local cloud services512will not be described in detail herein, except to the extent it relates to the synchronization aspects, so as not to unnecessarily complicate this disclosure.

FIG. 6is a relational diagram of the functional aspects of an architecture for synchronizing LFS204and RFS202, which is implemented within local cloud server104. In this illustrated embodiment, the functional aspects are provided by local cloud services512, but the functional elements of the system can be distributed across other service modules or even other machines.

LFS handler602receives requests for access (e.g., read requests, write requests, etc.) from local clients110. In this particular example, clients110are WINDOWS® clients, and LFS handler602is a server application that includes Samba. (Samba is an open source MS WINDOWS® networking protocol server.) However, the present invention is not limited to these particular examples. Rather, these particular examples, as well as others used in this disclosure, are merely used to provide a clear explanation of the invention. Indeed, a significant advantage of the present invention is that it can be implemented with a wide variety of server applications and file system protocols (e.g., NFS).

Local client110is a device/process used to access the files in LFS204hosted by local cloud server104. A user maps the “Share” that is exported by LFS handler602(e.g., via Server Messaging Block (SMB) protocol) and then accesses the files and folders within the exported share. In such an example, Samba could export the files and folders of LFS204to external Windows clients via SMB protocol.

Local VFS module604is a software plugin that monitors I/O calls to LFS204to detect local events (changes) being made to LFS204, which includes metadata606and data files in local file store514. LFS object I/O module608manages the I/O subsystem for organized data file storage and access on LFS204. In this embodiment, local VFS module604does not provide a virtual file system for local client110. Rather, local VFS module604monitors the file system calls going to the local file system form the local client110based on the protocol that has been implemented. When local VFS module604detects a local event (e.g., a change to LFS204made by local client110), local VFS module604executes a trap that generates local event information based on the local event and provides the local event information to local data monitor610. The types of local events are the same as the types of remote events.

For each local event, local data monitor610receives the local event information from local VFS module604, and then enters a local event record in a local event database612. Optionally, local data monitor610can filter irrelevant and/or redundant local events before entering the local events into database612(e.g., by implementing phase 0-1 processing as described below, etc.). Local data monitor610can also notify a local synchronizer616of a local event and can receive synchronization commands from local synchronizer616. Local data monitor610is also responsible for copying/moving local event records from local event database612to a local event view database614for synchronization purposes. For example, local data monitor610can move only local event records for local events that occurred during an event synchronization period determined by local synchronizer616.

Local event database612provides storage for local event records in a scalable relational database schema. Local event records are stored in local event database612in chronological order as local events occur.

Local event view database614stores local event records that will be undergoing synchronization. The schema for database614is the same as for database612, such that records stored in database612can be easily copied/moved to database614. Once local data monitor610moves the local event records from local database612to local event view database614, the local records in view database614are considered being processed for synchronization. Accordingly, local data monitor610removes the corresponding local event records from local event database612. Local event records can be stored in local event view database chronologically, and subsequently accessed therefrom chronologically and/or according to the hierarchy of LFS204.

Local synchronizer616is responsible for driving the synchronization process between the remote cloud102and the local cloud104in this embodiment. Accordingly, local synchronizer616is responsible for periodically initiating synchronization, which it can do in a variety of ways. For example, local synchronizer616can initiate synchronization whenever local data monitor610notifies it of a local event occurring. As another example, local synchronizer616can initiate synchronization periodically, for example, according to a time period defined by the client or by the system (e.g., every minute, every 15 minutes, etc.). As still another example, local synchronizer616can initiate synchronization upon receiving one or more remote event records from remote cloud102, for example, via an open (e.g., always on) connection established over internet106between local cloud interface418(FIG. 4) and a remote cloud interface618. These and other methods by which local synchronizer616can initiate synchronization will be apparent in view of this disclosure.

Local synchronizer616is also responsible for receiving (and optionally requesting) remote event records from remote cloud102over internet106. When remote event records are received, local synchronizer stores the remote event records in a remote event database620. In an alternative embodiment, only remote event information needs to be received from remote cloud102, and new remote event records can be generated by remote event database620. In the present embodiment, however, it will be assumed that local synchronizer616receives remote event records (e.g., in a table format, etc.) and stores them in remote event database620.

In response to initiating synchronization, local synchronizer616copies at least some of the remote event records (e.g., those associated with an event sync period) from remote event database620to a remote event view database622. Local synchronizer616then causes remote event database620to purge the copied remote event records therefrom. The schemas for remote databases412,620, and622are the same in the present embodiment.

Local synchronizer616also intercommunicates with an event processor624. In particular, local synchronizer616can instruct event processor624to begin event processing, which will result in file system operations being generated based on the local and remote events stored in view databases614and622. In some embodiments, local synchronizer616also receives communications from event processor624. For example, event processor624can notify synchronizer616that event processing is completed for a current event sync period. In other embodiments, event processor624might also provide file system operations to local synchronizer616.

Event processor624carries out event-based processing on the local event records and remote event records stored in local event view database614and remote event view database622, respectively. As will be described in further detail below, event processor624is operative to query local event view database614and the remote event view database622for local event records and remote event records, respectively. Event processor624then processes the returned local and remote event records into processed event records and uses the processed event records to generate file system operations that will synchronize RFS202and LFS204as of the end time (T2) of the current event synchronization period, once the file system actions are applied to the appropriate file systems. Event processor624outputs the generated file system operations to sync actions handler626. Optionally, event processor624could provide the operations to synchronizer616prior to the operations being provided to sync actions handler626.

Sync actions handler626receives the file system operations and applies the file system operations to RFS202and LFS204using a set of sync server application program interfaces (APIs)627. The sync server APIs627enable sync actions handler626to apply file system operations on LFS204via LFS handler602. The APIs627also enable sync actions handler626to perform file system operations on RFS202remotely via remote cloud interface618, internet106, local cloud interface418(FIG. 4) and remote synchronizer416(FIG. 4). Remote synchronizer416in turn applies, for example using complementary APIs, the received file system operations to RFS202via RFS handler402. File system operations that can be applied to RFS202and LFS204via the sync server APIs627include, but are not limited to, pushing (uploading) files and folders, pulling (downloading) files and folders, creating files and folders, moving files and folders, deleting files and folders, renaming files and folders, and FRS and LRS synchronization processes. If sync actions handler626receives an FRS or LRS operation, sync actions handler626is operative to utilize APIs627to acquire metadata snapshots of the target paths on LFS204and RFS202via LFS handler602and RFS handler402(via Internet106), respectively, and then bi-directionally resynchronize the target paths on each of LFS204and RFS202. Finally, it should be noted that sync actions handler626can optionally use different APIs depending on the number of file system operations that have to be applied, the number of files that have to be transmitted, the size of the files that have to be transmitted, etc.

Sync actions handler626, via APIs627, has the additional function of updating sync table628as paths are synchronized. Sync table628store the path of every file system path that has been synchronized in LFS204and RFS202. Once paths are synchronized, sync actions handler626will utilize the APIs627to update sync table628.

Once the file system actions generated by event processor624have been applied to RFS202and LFS204, RFS202and LFS204are synchronized as of the end of the event synchronization period (T2). Thus, RFS202and LFS204can be efficiently and repeatedly synchronized by monitoring local and remote file systems for local and remote events, and then applying those events to the other file system. The inventors have found that this event-based synchronization process scales well to file systems uses fewer system resources. Moreover, because event-based synchronization can be performed often (e.g., at periods of a minute or less), the invention provides near steady-state synchronization between the RFS202and LFS204.

As will be apparent from the description thus far, the steady-state synchronization process is primarily implemented and controlled by the local cloud server104. However, the functional elements of the remote cloud102(FIG. 4) and the local cloud104(FIG. 6) could be reversed, such that the remote cloud primarily implements the steady-state synchronization. As another example, the functional elements of the local cloud104(FIG. 6) could be replicated on the remote cloud102, such that either server could carry out the particular functions of steady-state synchronization as desired.

FIG. 7is a block diagram of the functional aspects of an exemplary event database702according to the present invention. Event database702can be employed as any of event databases412,612-614, and620-622shown inFIGS. 4 and 6. Event database702includes an event frontend704, an event backend706, an SQLite database backend708, and an event record store712.

Event frontend704provides an interface for event database702to interact with a data monitor410/610, local synchronizer616, and/or event processor624. Event frontend704receives event information for new events and, in response, calls event backend706to create new records in response to each event notification. Event frontend704can also receive event records (e.g., in table format, etc.) and call event backend706to store the event records. Event frontend704also receives queries for event records from event processor624and is operative to retrieve the requested data from event backend706and provide the data to event processor624. Event frontend704permits events to be stored in event record store712in chronological order, and optionally can export records associated with events chronologically and/or according to the hierarchy of either RFS202and LFS204.

Event backend706creates, stores, and retrieves records to and from event record store712using, in this embodiment, an SQLite database backend708. SQLite database backend708is a self-contained, scalable, embedded database useful for event storage. As another option, database702could employ a flat file backend to facilitate encoding the database model as a single file.

To create a record of an event, event backend706receives event information from event frontend704and calls SQLite database backend708to create and store the record(s) for that event in event record store712. Additionally, responsive to a query from event frontend704, event backend706is operative to retrieve records from event record store712(via SQLite backend708) and provide those records to event frontend704. Event frontend704, in turn, provides the event records to the requesting entity, such as data monitor410/610, synchronizer616, or event processor624. In a particular embodiment, the query requests records for events associated with a particular time period.

FIG. 8shows a database schema800for event database702according to the present invention. Schema800includes an events table802, a file systems table804, and a renames table806.

Each event record in Events table802includes an Event ID field810, a Full Path field812, a New Path field814, a UQID field816, a Path Type field818, an Event Type field820, a Timestamp field822, a User ID field824, a Stmtime field826, a Size field828, and a Flags field830. A record is created in Events table802for each event that occurs in an associated file system other than rename events. For rename events (file or folder), two event records802are created: one from the source path perspective and one from the destination path perspective.

Event ID810is a key field of events table802and includes data uniquely identifying each event record802. Event ID810is assigned by the database (e.g., by SQLite backend708). Full Path812field includes data indicating the path of the file system object on which the event occurred. For RENAME events full path field812for the source event record will include the source path, whereas field812will include the destination path for the destination event record. Thus, path information can be accessed from both rename path perspectives.

New Path field814includes data indicating the new path assigned when an event occurred. UQID field816includes data uniquely identifying the file system object in the RFS202. The UQID field can be used, for example, to identify the same file system objects on different file systems (e.g., RFS202and LFS204) and/or associate a virtual file system object (e.g., in metadata database406) with the data file in the data store (e.g., in client data store322). Path Type field818includes data (e.g., a flag) indicating if the event record is associated with a file or a folder. Event Type field820includes data indicating the type of event (e.g., CREATE, UPDATE, UNLINK, RENAME_SRC_FILE, RENAME_DST_FILE, MKDIR, RMDIR, RENAME_SRC_DIR, RENAME_DST_DIR) that the event record is associated with. Timestamp field822includes data indicating the time the event occurred. User ID field824include data identifying the user that caused the event. Stmtime field826includes data indicating the time when the event on the associated file system object was completed. Size field828includes data indicating the size of a data file associated with the file system object. Size field828is set to zero (0) when the associated file system object is a folder. Other field830includes other data that might be useful during event processing (e.g., error information, reduction status, feedback, etc.).

Each record in File Systems table804includes a File System (FS) ID field840, a Full Path field,842, a Child Name field844, a Parent Path field846, a Parent Depth field848, a Path type field850, a UQID field852, a Stmtime field854, a Size field856, and a Checksum field858. A record is created in File Systems table804for each file system path on which an event occurred. As shown inFIG. 8, there is a many-to-one relationship between records in Events table802and records in File Systems table804, such that many events can happen on one file system path. Storing the file system paths on which events occurred facilitates event processing as will be described below.

File System (FS) ID field840is the key field of File Systems table804and includes data uniquely identifying a file systems record. Child Name field844includes data representing the name of a child file system object to the path contained in Full Path field842. Parent Path field846includes data representing the parent path of the path represented in Full Path842. Parent Depth field848includes data indicating the depth of the path stored in Parent Path field846. Finally, Checksum field858includes a checksum for the file system object located at the path defined by full path field842. The checksum value is useful for comparison during synchronization when the full path842points to a file. Full Path field842, Path Type field850, UQID field852, Stmtime field854, and Size field856contain the same data as Full Path field812, Path Type field818, UQID field816, Stmtime field826, and Size field828, respectively, of Events table802. However, Stmtime field854can contains data indicating the time when the last event on the associated file system path was completed.

Records are stored in Renames table for all rename events. Recall that rename events encompass both rename events and move events on file system objects. Each record in Renames table806includes a Rename ID field870, a Source Event ID field872, and a Destination Event ID field874. As is apparent fromFIG. 8, there is a two-to-one relationship between records in Events table802and records in Renames table806. Thus, two event records in Events table802(source and destination) are associated with each record in Renames table806.

Rename ID field870is the key field of Renames table806and include data uniquely identifying each rename record. Source Event ID field872contains data representing an Event ID identifying the source event record for the rename event. The source event record provides a record of the rename event from the perspective of the source path of the file or directory. Destination Event ID field874contains data representing an Event ID identifying the destination event record for the rename event. The destination event record provides a record of the rename event from the perspective of the destination path of the file or directory.

The following exemplary queries can be used to insert contents into the event database702. To add an event record to Event table802, the following query can be used:

To add a file system record to File Systems table804, the following query can be used:

To add a rename record to Renames table806, the following query can be used:

FIG. 9is a block diagram showing the functional aspects of event processor624in greater detail. Event processor624includes a series of processes (Phase 0 to Phase 3) that reduce, modify, and coalesce the LFS and RFS events. The processed set of LFS and RFS events are then used to generate file system operations that can be applied to RFS202and LFS204. After the file system operations are applied to RFS202and LFS204, the file systems will be synchronized as of the end of the event synchronization period.

Event processor624includes an RFS phase 0 module902, an LFS phase 0 module904, an RFS phase 1 module906, and an LFS phase 1 module908. Event processor624also includes a phase 2 module910and a phase 3 module912. The modules of event processor624have read/write/modify access to the records (event records, file system records, and rename records) in remote event view database622and in local event view database614, for example, via respective event frontends704. Alternatively, the records in view databases622and614can be cached for quicker access.

RFS phase 0 module902accesses the remote event records802, file system records804, and rename records806of remote event view database622and performs various path reduction and modification processes to the remote event records802. Subsequently, RFS Phase 1 module906accesses the remote event records, file system records, and rename records, as modified by phase 0 module902, and performs further reduction of the remote event records802. RFS phase 1 module906can utilize a set of look-up tables to determine how the number of remote event records802can be reduced further. LFS phase 0 module904and LFS phase 1 module908operate substantially the same on the local event records, file system records, and rename records of local event view database614.

As shown inFIG. 9, the phase 0 and phase 1 processes are performed on local event records and remote event records independently. The RFS and LFS phase 0 and phase 1 processes are shown separately for clarity, but these modules can be combined into single phase 0 and phase 1 modules if desired, as long as the local and remote event records are processed independently of each other during phase 0 and phase 1.

The modified local event records and modified remote event records produced by phase 0 and phase 1 processing are combined and processed further by phase 2 module910. Phase 2 module910can reduce the remote event records and local event records even further. Additionally, phase 2 module910compares local and remote events that occur on common file system object paths in LFS204and RFS202, and resolves conflicts (if any) between the local and remote events. In a particular embodiment, phase 2 module910utilizes a series of lookup tables and APIs to resolve LFS-RFS event conflicts. As part of the conflict resolution process, phase 2 module910generates file system operations that, when applied to RFS202and/or LFS204, implement the conflict resolution.

Phase 3 module912is utilized to generate file system operations based on the remaining local and remote event records. Because phase 2 module910and phase 3 module912both generate file system operations to be applied to RFS202and LFS204, modules910and912can also be perceived as a single module914and their respective functions can be implemented in combination.

Phase 0 event processing will now be described in greater detail. Phase 0 processing is based on the types of events that the event records are associated with. In particular, phase 0 processing is based on RENAME events and RMDIR events. Phase 0 event processing (1) adjusts path prefixes relevant to folder and file renames, and (2) removes events that happened within a deleted folder as these events are no longer relevant.

Phase 0 path modification is carried out on events that happened on a path that changed at some time. The events whose paths are being modified will have a temporal precedence with regard to the event that necessitated the path modifications. Usually, the event records being modified are those that occurred on the path prior to the rename event. All the events that happened after the rename event remain unchanged. The following are two examples of phase 0 path modifications for RENAME:(1) UPDATE /A/b.txt+RENAME /A to /B=RENAME /A to /B+UPDATE /B/b.txt(2) RENAME /A/B/c.txt to /A/B/C/d.txt+RENAME /A to /X=RENAME /A to /X+RENAME /X/B/c.txt to /X/B/C/d.txt

In example (1), two events previously made to one file system (e.g., RFS202) are shown on the left hand side (LHS) of the equation, and two modified events are shown on the right hand side (RHS) of the equation. On the LHS, an update event is followed by a rename event. Phase 0 module902modifies the LHS events as shown on the RHS. In particular, phase 0 module902chronologically moves the rename event ahead of the update event and moves the update event after the rename event, for example by modifying timestamp field822in the event records. Phase 0 module902also modifies the path field812in the UPDATE event to reflect the new path. Thus, if the events on the RHS of example (1) were applied to a second file system (e.g., LFS202), the second file system would be synchronized with the first file system.

In example (2), the two events on the LHS have been made to a first file system. In particular, a file “c.txt” has been renamed to “d.txt” and moved to a new director by the first RENAME event. Note that the file RENAME event accomplishes both the rename and move tasks. The second RENAME changes the name of the /A directory to the /X directory. Phase 0 module902modifies these events by chronologically moving the folder RENAME event in ahead of the file RENAME event. Phase 0 module also modifies the paths for the file rename event records to reflect the prior folder RENAME event. Thus, if the events on the RHS of example (2) were applied to a second file system, the second file system would be synchronized with the first file system.

The following is exemplary pseudo-code for a phase 0 path modification algorithm.

Phase 0 module902performs the above algorithm for each rename event record in Renames table806(line 1). The algorithm determines when the rename even occurred and defines a subsequent time. The algorithm also determines the source path (e.g., /A in example 1) and the destination path (e.g., /B in example 1). Then, via the nested FOR loop, phase 0 module902checks all the event records in table802in chronological order. Module902determines the ones of the other event records containing the source path, and modifies those records that occurred before the rename event with the destination path. The algorithm also modifies the timestamps of those events such that they occur after the rename event.

Phase 0 module902also checks for RMDIR (remove directory) events and deletes event records that are no longer relevant in view of the RMDIR event. An example of this process is shown below:(1) CREATE /A/a.txt+MKDIR /A/B+CREATE /A/B/c.txt+RMDIR A=RMDIR A

On the LHS of the example, three events occur on folder A and then folder A is deleted in a first file system. Accordingly, phase 0 module902deletes the three events occurring before the RMDIR A event. Thus, the only remaining event on the RHS is RMDIR A. When RMDIR A is applied to a second file system, the first and second file systems will be synchronized (without a folder A). The following is pseudo-code for implementing this event reduction:

The above algorithm searches the event records in table802and returns each RMDIR event. For each RMDIR event, the algorithm determines the removed folder and the timestamp for the RMDIR event. Then, the algorithm searches through all events in table802by timestamp. If the event's timestamp is later than the timestamp of the RMDIR event, then the event record is left alone. However, if the event's timestamp is before that of the RMDIR event and if the event's path field812starts with or is a child of the deleted folder, then the event is removed.

Based on the above processes, phase 0 module902modifies paths and reduces remote event records. Phase 0 module904modifies paths and reduces local event records in substantially the same manner, as indicated previously.

Following phase 0 modification and reduction, RFS phase 1 module906performs event reduction and modification on redundant remote event records. Phase 1 event processing reduces consecutive and redundant events that happened on the same file system object path. The following are some examples:(1) CREATE a.txt+UPDATE a.txt+UPDATE a.txt=CREATE a.txt.(2) CREATE /A/a.txt+UNLINK /A/a.txt=NONE(3) RENAME /A to /B+RENAME /B to /C=RENAME /A to /C(4) RENAME /A to /B+RMDIR /B=RMDIR /A

In example (1), the common file system object is a.txt. On the LHS, a.txt is created and then updated twice. RFS phase 1 module906compresses these three events to one CREATE event on the RHS. In other words, the update events are removed from the events table802. This CREATE event will cause a.txt, in its most recent form, to be created on LFS204.

In example (2), the common file system object is a.txt. On the LHS, a.txt is created and then deleted. Therefore, no action needs to be taken on the RHS (e.g., at the LFS204), and RFS phase 1 module906deletes the CREATE and UNLINK events from the events table802.

In example (3), the common file system object is folder /B. On the LHS, folder /A is renamed to folder /B and then folder /B is renamed to folder /C. RFS phase 1 module906reduces these two events to a RENAME event from folder /A to folder /C. The intermediate rename event to folder /B can be eliminated. Folder /A will be renamed to folder /C on LFS204.

In example (4), the common file system object is folder /B. On the LHS, folder /A is renamed to folder /B. Then, folder /B is deleted. RFS phase 1 module906reduces these two events to RMDIR /A on the RHS. When RMDIR /A is applied to LFS204, folder /A will be removed from LFS204.

RFS phase 1 module906operates as follows. When phase 1 reduction begins, RFS phase 1 module906loops through the file system paths in file systems table804. For each file system path record in table804, retrieves the associated event records in events table802that occurred on that path and analyzes them in chronological order according to timestamp (timestamp field822). For each two consecutive event records, RFS phase 1 module906utilizes a reduction API to access tables (FIGS. 10A-10D) to determine the appropriate event reduction. RFS phase 1 module906determines the appropriate event reduction and modifies Events table802accordingly. Thus, the size of Events table can decrease as phase 1 progresses. Each reduced remote event record can then be used for a next event reduction determination on that file system path. Once all event reductions for events on a particular path are complete, RFS phase 1 module906moves to the next file system path in table804and repeats the reduction process. When all file system paths have been processed, phase 1 reduction is complete.

The following is exemplary pseudo-code that implements phase 1 reduction.

LFS phase 1 module908operates substantially the same as RFS phase 1 module906, except that it operates on the local events from view database614as previously modified by phase 0 module904. Optionally, RFS and LFS phase 1 modules906and908can be combined into a single module that performs phase 1 reduction, independently, on the remote event records and the local event records.

FIGS. 10A-10Dshow event reduction tables employed during the phase 1 reduction process to determine the appropriate event reductions (if any). These tables indicate operations performed on consecutive events (at times T and T+1) that occur on the same file system object path.

FIG. 10Ashows a File/File event reduction table1002. The phase 1 reduction module utilizes table1002if the two consecutive events in question are file events. The data in Path Type field818in the event records will indicate if an event record is associated with a folder or a file. In table1002, the columns1004-1012indicate file event types for the file event happening at time (T), whereas the rows1014-1022indicate file event types for the consecutive file event happening at time (T+1). Time (T) and (T+1) can be based on the timestamps in fields822or the timestamps in Stmtime fields826as desired.

File event types for a file event occurring at time (T) include CREATE1004, UPDATE1006, UNLINK1008, RENAME_SRC_FILE (RSF)1010, and RENAME_DST_FILE (RDF) from a second source (SRC2). Possible event types for a file event occurring at time (T+1) include CREATE1014, UPDATE1016, UNLINK1018, RSF to a second destination (DST2)1020, and RDF. The intersection of the rows and columns in table1002provide the event reduction (if any) for the two particular events to the phase 1 reduction process.

Some column-and-row intersections in table1002indicate a Dirty Event State (DES). A DES indicates that the succession of the two events should not happen. For example, the same file should not be created at times (T) and (T+1). Accordingly, the intersection of column1004and row1014indicates DES. The same is true for other combinations of events. If a DES state occurs, the phase 1 process can optionally log that the DES occurred, for example in the associated Other fields830.

Some other intersections indicate that no reduction is possible (NR). In these cases, the phase 1 process would move on from the particular event combination to the next event combination. Conversely, the intersection of column1004and row1018indicates to reduce events (RE). This combination of events corresponds to example 2 described above, and the phase 1 reduction process can reduce these two events.

Other intersections in table1002indicate particular reductions. For example, the intersection of column1004(CREATE) and row1016(UPDATE) can be reduced to CREATE event with a timestamp corresponding to the UPDATE event1016. Similarly, the intersection of column1004(CREATE) and row1020(RSF to DST2) can be reduced to a CREATE DST2 event. The intersection of column1006(UPDATE) and row1016(UPDATE) can be reduced to a single UPDATE that corresponds to the second (T+1) update. The intersection of column1008(UNLINK) and row1014(CREATE) can be reduced to a single UPDATE event. Furthermore, the intersection of column1012(RDF from SRC2) and column1018(UNLINK) can be reduced to an UNLINL SRC 2 event. The intersection of column1012(RDF from SRC2) and column1020(RSF to DST2) can be reduced to RENAME_SRC_FILE to DST2. Finally, the intersection of column1012(RDF from SRC2) and row1022(RDF) can be reduced to Unlink SRC2 and RDF. For example, RENAME /A/a.txt to /A/b.txt+RENAME /A/b.txt to A/c.txt reduces to UNLINK /A/a.txt+RENAME /A/b.txt to /A/c.txt. Event records are reduced because a RENAME event (2 event records) is replaced with an UNLINK event (1 event record).

FIG. 10Bshows a File/Directory event reduction table1024, which is utilized when the event at time (T) is a file event and the event at time (T+1) is a folder event. Columns1026-1034correspond to the available file events, whereas rows1038-1042correspond to the folder events. The folder events include MKDIR, RMDIR, RENAME_SRC_DIR (RSD), AND RENAME_DST_DIR (RDD). Each combination of events in table1024results in either a DES or NR. Accordingly, for DES results, the phase 1 process logs the DES. Otherwise, the phase 1 process moves to the next set of event records.

FIG. 10Cshows a Directory/File event reduction table1044, which is utilized when the event at time (T) is a folder event and the event at time (T+1) is a file event. Columns1046-1052correspond to the folder events, whereas rows1054-1062correspond to the file events. Each combination of events in table1044results in either a DES or NR. Accordingly, for a DES result, the phase 1 process logs the DES. Otherwise, the phase 1 process moves to the next set of event records.

FIG. 10Dshows a Directory/Directory event reduction table1064, which is utilized when the event at time (T) is a folder event and the event at time (T+1) is also a folder event. Columns1066-1072and rows1074-1080correspond to the folder events. Many of the combinations in table1064result in DES and NR. The intersection of column1066(MKDIR) and row1076(RMDIR) results in a reduce events. In such a case, the phase 1 process would remove the MKDIR and RMDIR events from the associated events table802.

The intersection of column1072(RDD) and row1076(RMDIR) indicates that an RDD event at time (T) and an RSD event at time (T+1) can be reduced to RMDIR SRC. This is similar to Example 4 given above. The intersection of column1072(RDD) and row1078(RSD) indicates that an RDD at time (T) event followed by an RSD event at time (T+1) reduces to RSD SRC1 to DST 2. This is similar to Example 3 given above.

Returning now toFIG. 9, after phase 0 and phase 1 processing, the remote records associated with RFS202and the local event records associated with LFS204are merged and processed jointly by the phase 2 module910according to file system object path. The phase 2 module910reduces remote and local events associated with the same file system object, resolves conflicts between local and remote events on the same file system object, and generates file system operations according to the conflict resolution.

The phase 2 module910reduces local and remote events only in the following three cases:(1) LFS MKDIR A+RFS MKDIR A=NONE(2) LFS RMDIR A+RFS RMDIR A=NONE(3) LFS UNLINK A+RFS UNLINK A=NONE

In each of the three cases above, the same folder is made or deleted, or the same file is deleted, on both the LFS204and the RFS202. Therefore, phase 2 module910is able to remove the event records for these events.

The phase 2 module910has another important function in that it resolves conflicts between local and remote events that happen on a common file system object. A conflict happens when file system operations on any specific path does not leave the event stream in a consistent state. To resolve these conflicts, phase 2 module910utilizes conflict resolution look-up tables.

FIGS. 11A-11Ddefine conflict resolution tables that phase 2 module910uses to resolve conflicts. The tables define file system operations at the intersections of the conflicting RFS and LFS events that will resolve the conflict.

FIG. 11Ashows a table1102for resolving conflicts between RFS file events and LFS file events. The RFS file events include CREATE file A in column1104, UPDATE A in column1106, UNLINK A in column1108, RENAME_SRC_FILE A TO C in column1110, and RENAME_DST_FILE C to A in column1112. The LFS file events include CREATE file A in row1114, UPDATE A in row1116, UNLINK A in row1118, RENAME_SRC_FILE A TO B in row1120, and RENAME_DST_FILE C to A in row1122.

The following are examples of conflict resolution provided by table1102. The intersection of column1104(RFS CREATE A) and row1114(LFS CREATE A) indicates an operation “Pull A”. The “pull” operation represents both a push to the RFS202and a pull to the LFS204. Accordingly, “Pull A” will result in the LFS file A being pushed to RFS202and the RFS file A being pulled to the LFS204. Optionally, because LFS file A is pushed to RFS202, the RFS file A can be stored as a prior version. Where versioning is employed in RFS202, the prior versions of file A in RFS202can be recovered if needed.

As another example, the intersections of column1104(RFS CREATE A) and rows1116-1120result in a (*) action. The (*) indicates that this combination of events should not happen. If it does, a full rescan sync (FRS) is triggered to resynchronize the LFS204and the RFS202.

As still another example, the intersection of column1104(RFS CREATE A) and row1122(LFS RDF B to A) indicates an operation LMove B to A. The LMove action causes the file B in RFS202to be renamed as file A in the RFS202. If the RFS202includes versioning, the existing file A in RFS202can be stored as an older version of file A in view of the renaming of B.

As yet another example, the intersection of column1106(RFS UPDATE A) and row1118(LFS UNLINK A), results in an action Pull A. Accordingly, RFS file A is pulled to LFS204and stored thereon as file A.

As another example, the intersection of column1108(RFS UNLINK A) and row1118(LFS UNLINK A) indicates No Action (NA). However, operations are generated that cause sync actions handler626to modify the sync table628to remove the file path therefrom.

As still another example, the intersection of column1110(RFS RENAME_SRC_FILE A to C) and row1116(UPDATE A) indicate the operations Move A to C and Push C. The Move operation causes file A to be renamed as file C in LFS204. The Push C operation causes the renamed file C on LFS204to be pushed to RFS202and stored as another version of file C in RFS202.

The other operations specified by table1102should be apparent in view of the above examples. It will also be apparent, that the operations specified in table1102for a particular conflict might not be a perfect solution to that conflict. However, when the RFS202(or optionally the LFS204) includes file versioning, versions of data files occurring in the RFS202and in the LFS204can be maintained and can be recovered. It should also be noted that the conflict resolution operations specified in table1102can be modified to resolve conflicts in a desired way.

FIG. 11Bshows a table1124for resolving conflicts between LFS file events and RFS directory events. The RFS directory events include MKDIR A in column1126, RMDIR A in column1128, RENAME_SRC_DIR (RSD) A to C in column1130, and RENAME_DST_DIR (RDD) C to A in column1132. Rows1134-1142correspond to the file events discussed above. Each row and column intersection of table1124indicates either “Skip” or (*). Skip indicates that no file system operations should be taken, even though the two events might be incompatible. Log entries (e.g., warnings) can be created for skip events, but an FRS should not be triggered. As indicated above, a (*) indicates a combination of events that should not occur. Therefore, an error is logged and an RFS triggered.

FIG. 11Cshows a table1144for resolving conflicts between LFS directory events and RFS file events. Columns1146-1154indicate the RFS file events, and the rows1156-1162indicate the LFS directory events. Each row and column intersection of table1144indicates either “Skip” or (*) discussed above inFIG. 11B.

FIG. 11Dshows a table1164for resolving conflicts between LFS directory events and RFS directory events. Columns1166-1172indicate the RFS directory events, and rows1174-1180indicate the LFS directory events. Each row and column intersection of table1164indicates the conflict resolution operation for that combination of events.

Some combinations indicate a (*). Accordingly, the conflict resolution of those combinations is the same as above (i.e., log error and perform FRS). Other intersections indicate FRS, in which an FRS will be performed. Still other intersections indicate LRS, which indicates that the associated directory should be subjected to a limited rescan synchronization process. Other intersections indicate that folder paths should be moved/renamed. LMove indicates that a corresponding folder path should be moved/renamed in the RFS202. Conversely, Move indicates a folder path should be moved/rename in LFS204. Finally, No Action (NA) indicates that no action should be taken for the particular combination of events. However, operations might still be generated to add a path to sync table628or recursively remove a path from sync table628.

As with table1102, the conflict resolution actions described in tables1124,1144, and1164might be compromise solutions. However, the conflict resolution actions can be implemented conservatively, and to favor data preservation, such as via versioning. Additionally, FRS and LRS processes can be called to ensure the integrity of the synchronization.

Returning now toFIG. 9, the phase 3 module912generates file system operations based on the processed remote and local events produced by the phase 0-2 modules. The phase 3 module912also integrates (e.g., chronologically, etc.) the file system operations generated by phase 2 module910during conflict resolution into the file system operations that will be output. Phase 3 module912then outputs a file system operation stream, including operations that it generated and operations that phase 2 module910generated, to sync actions handler626.

The following are examples of file system operations that can be generated by phase 3 module912based on the processed local and remote event records.(1) LFS UPDATE A+RFS UNLINK B=Push file A+Delete file B(2) LFS RENAME A to B+RFS RENAME A to C=Push file B+Pull file C(3) LFS MKDIR A+RFS UNLINK B+RFS RMDIR C=Push folder A+Delete file B+Delete folder C

In the above examples, the operations for example (1) are generated by phase 3 module912, the operations for example (2) are generated by phase 2 module910using table1102, and the operations of example (3) are generated by phase 3 module912. Phase 3 module912would assemble these file system operations into an operation output stream and provide that stream to sync action handler626.

To generate file system operations, phase 3 module912categorizes events into three categories. Those categories are independent events, simple dependent events, and complex dependent events. An independent event is an event whose path has no events in the other file system. For example, a local event is independent if there are no remote events for its path. Similarly, a remote event is independent if there are no local events for its path. All other events are dependent events. A simple dependent event is a local event for whose path there is only one RFS event. Similarly, a simple dependent event is also a remote event for whose path there is only one LFS event. An event that is not independent or simple dependent is complex dependent.

Phase 3 module912generates file system operations directly for independent events. However, phase 3 module912relies on the conflict resolution of phase 2 to generate file system operations for simple dependent events. For complex dependent events, phase 3 module912collects the paths of the complex dependent events for limited rescan syncs of those paths. Phase 3 module912further generates operations to initiate the limited rescan syncs and full rescan syncs in the file system operation stream. Phase 3 module912generates and outputs the file system operation stream to sync actions handler626for all the processed event records generated during phases 0-3.

The following is pseudo-code to implement phase 3 processing:

gen_op(event):generate_operation(event)mark_as_processed(event)collect_lrs_paths(event):collect the Limited Rescan Sync paths for event and all of its dependentevents mark_as_processed(event and all its dependent events)generate_operations(LFS events, CFS events)sort LFS and CFS events by timestampfor lfs_event in all non-processed LFS events:if is_independent_event(lfs_event): gen_op(lfs_event)elif is_simple_dependent_event(lfs_event):cfs_dep_event = get_dependent_event(lfs_event)for cfs_event in non-processed CFS events with timestamp <timestamp(cfs_dep_event):if is_independent_event(cfs_event):gen_op(cfs_event)else:collect_lrs_paths(cfs_event)generate operations for simple dependent LFS/CFS eventsaccording to the LFS/CFS event conflict resolution tablespresented in phase 2else: # the LFS event has more than one dependencycollect_lrs_paths(lfs_event)# process the remainder of CFS eventsfor cfs_event in all non-processed CFS events:gen_op(cfs_event)ops = generate_operations(LFS events, CFS events)performs_actions(ops)if limited_rescan_sync_path_list is not empty:perform LRS on the limited_rescan_sync_path_list

Finally, it should be noted that the file system operations available to be output by event processor624will be determined by the application and file system protocols being used. However, it is expected that file system operations such as push, pull, delete, move, rename, etc. will be widely employed. Additionally, the file system operations that are used can also include operations to trigger other processes (e.g., FRS, LRS, modification of tables, etc.).

Some methods of the present invention will now be described with reference toFIGS. 12-14. For the sake of clear explanation, these methods might be described with reference to particular elements discussed herein that perform particular functions. However, it should be noted that other elements, whether explicitly described herein or created in view of the present disclosure, could be substituted for those cited without departing from the scope of the present invention. Therefore, it should be understood that the methods of the present invention are not limited to any particular element(s) that perform(s) any particular function(s). Further, some steps of the methods presented need not necessarily occur in the order shown. For example, in some cases two or more method steps may occur simultaneously. These and other variations of the methods disclosed herein will be readily apparent, especially in view of the description of the present invention provided previously herein, and are considered to be within the full scope of the invention.

FIG. 12is a flowchart summarizing a method1200for synchronizing a file system (FS) and a remote file system (RFS) that is located remotely from the FS. In a first step1202, the FS (e.g., LFS204) is monitored for FS events, where each of the FS events indicates a change made to the FS. In a second step1204, a plurality of event records are generated based on the FS events, where each record is associated with one of the FS events. In a third step1206, a plurality of RFS event records are received, where each RFS event record indicates a remote event that happened on the RFS (e.g., RFS202). In a fourth step1208, file system operations are generated based at least in part on the FS event records and the RFS event records. Then, in a fifth step1210, the file system operations are communicated to the FS and the RFS to synchronize the FS and the RFS.

FIG. 13is a flowchart summarizing another method1300for synchronizing a file system (FS) and a remote file system (RFS) that is located remotely from said FS. In a first step1302, the FS (e.g., RFS202) is monitored for events, where each of the events indicates a change made to the FS. In a second step1304, an event record is generated in response to the occurrence of each of the events. In an optional third step1306, a request for event records is received from the RFS (e.g., LFS204). In a fourth step1308, at least one event record is transmitted to a remote file storage system having access to the RFS.

FIG. 14is a flowchart summarizing a method1400for generating file system operations for synchronizing a file system (FS) and a remote file system (RFS) that is remotely located from the FS. Method1400can be a method for performing step1208(generate file system operations) ofFIG. 12.

Method1400includes a first step1402wherein a plurality of event records, which are associated with a plurality of events, are accessed. Each of the invents corresponds to a change previously made the FS or the RFS. In a second step1404, the event records are processed to generate a set of processed event records. In a third step1406, file system operations are generated based at least in part on the set of processed event records. Each of the file system operations is operative to cause a change to at least one of the FS and the RFS. In a fourth step1408, the file system operations are output to cause synchronization of the FS and the RFS.

The description of particular embodiments of the present invention is now complete. Many of the described features may be substituted, altered or omitted without departing from the scope of the invention. For example, functional modules described with respect to the local cloud can also be implemented in the remote cloud. For example, an event processor could also be implemented in the remote cloud services such that event reduction could be performed, and file system operations could be generated, by the remote cloud. As another example, alternative conflict resolution actions can be developed depending on design goals. These and other deviations from the particular embodiments shown will be apparent to those skilled in the art, particularly in view of the foregoing disclosure.