1. Technical Field
The disclosure generally relates to a user data management system and a method.
2. Description of Related Art
In computer programming, user data is generated by an application for one or more users. The user data may include a user profile, user history, environment variables, and preferred settings. The more times a user uses an application, the more valuable the user data generated by the application is likely to be. However, if the application is upgraded to a newer version, the user data generated by older versions of the application may be not compatible with the newer versions of the application.
Many aspects of the embodiments can be better understood with references to the following drawings. The components in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the embodiments. Moreover, in the drawings, like reference numerals designate corresponding parts throughout the several views.
The disclosure is illustrated by way of example and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean at least one.
In general, the word “module,” as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming languages such as Java, C, or Assembly. One or more software instructions in the modules may be embedded in firmware, such as an EPROM. Modules may comprise connected logic units, such as gates and flip-flops, and programmable units such as programmable gate arrays or processors. The modules described herein may be implemented as software and/or hardware modules and may be stored in any type of computer-readable medium or other computer storage device.
In one embodiment, the storage system 20 may be a magnetic or an optical storage system, such as a hard disk drive, an optical drive, or a tape drive. The storage system 20 stores corresponding user data generated by an application in the electronic device 1. The user data may include a plurality of user data items. Each user data item records a specific field of data. For example, a user data item may comprise a user name, or an email address. In one embodiment, the user data may include a version data item for indicating the version of the user data.
In one embodiment, the user data management system 10 includes a version database 101, a reading module 102, a version obtaining module 103, a change listing module 104, an adjusting module 105 and a saving module 106. Each of the modules 101-106 may be a software program including one or more computerized instructions that are stored in the storage system 20 and executed by the processor 30.
The version database 101 stores version change history for user data. In general, the version change history includes a plurality of change items. A change log may record an addition of a user data item, a deletion of a user data item, or a modification of a user data item. Each change item includes a plurality of change logs associated with a version updated from a prior version. For example, a version change history may read as follows:
[ChangeLog#1=Add a new user data item“Username”]
[ChangeLog#2=Add a new user data item“Email”]
[ChangeLog#3=Detele the user data item“Alias”]
[ChangeLog#1=Delete the user data item“Username”]
[ChangeLog#2=Add a new user data item“PostCode”]
[ChangeLog#1=Delete the user data item“Postcode”]
According to the above exemplary change history, there are 3 change items. For change item#2, it records what the version 1.03 of user data is changed in comparison with the prior version (version 1.01 here). Furthermore, the change item#2 includes 2 change logs. Because version numbers increase, the highest version number is usually both the newest and latest version. For example, in the exemplary change history, the newest and latest version is version 1.07.
The reading module 102 reads current user data from a source. The source may be a database, a register, an INI file or an XML file, that is stored in the storage system 20. The reading module 102 may query the storage system 20 for storage space to temporarily store the current user data.
The version obtaining module 103 may obtain the current version of the current user data by reading the version data item from the current user data. The version obtaining module 103 may also obtain the latest version of user data from the version database 101. In one embodiment, the newest version recorded in the version database 101 is the latest version of the user data. The version obtaining module 103 may further determine whether the current version is older than the latest version.
The change listing module 104 may retrieve changes between the current version and the latest version from the version database 101. The change listing module 104 may calculate the number of versions between the current version and the latest version from the version database and obtain a change item for each of these versions. The change listing module 104 may extract change logs from the obtained change items and generate a change list according to the change logs.
The adjusting module 105 may apply the changes to the current user data and adjust the current version of the current user data to the latest version. In one embodiment, the adjusting module 105 may fetch each change log from the change list in order from older version to newer version. If the current version is newer than or equal to the latest version, there is no need to update the current user data. Otherwise, the system find changes between the current version and the latest one and apply the changes to the current version. If the change log records an addition of a user data item, the adjusting module 105 adds this user data item to the current user data. If the change log records a deletion of a user data item, the adjusting module 105 deletes this user data item from the current user data. In some embodiments, if the change log records a deletion of a user data item, the adjusting module 105 may invalidate this user data item by adding an invalidation mark to this user data item to the current user data. If the change log records a modification of a user data item, the adjusting module 105 modifies the user data item in the current user data.
The saving module 106 is used to save the current user data to the source.
In block S201, the reading module 102 reads current user data from a source.
In block S202, the version obtaining module 103 obtains the current version of the current user data by reading the version data item from the current user data and obtains the latest version of user data from the version database 101.
In block S203, the version obtaining module 103 determines whether the current version is older than the latest version. If the current version is older than the latest version, then the flow goes to block S204. If the current version is newer than or equal to the latest version, the flow ends.
In block S204, the change listing module 104 retrieves changes between the current version and the latest version from the version database 101. The change listing module 104 calculates versions between the current version and the latest version from the version database and obtains change item for each of these versions. Then the change listing module 104 extracts change logs from the obtained change items and generates a change list according to the change logs.
In block S205, the adjusting module 105 applies the changes to the current user data. In one embodiment, the adjusting module 105 fetches each change log from the change list in order from older version to newer version. If the change log records an addition of a user data item, the adjusting module 105 adds this user data item to the current user data. If the change log records a deletion of a user data item, the adjusting module 105 deletes this user data item from the current user data. In some embodiments, if the change log records a deletion of a user data item, the adjusting module 105 invalidates this user data item by adding an invalidation mark to this user data item in the current user data. If the change log records a modification of a user data item, the adjusting module 105 modifies the user data item in the current user data.
In block S206, the adjusting module 105 adjusts the current version of the current user data to the latest version.
In block S207, the saving module 106 saves the current user data to the source.
Depending on the embodiment, certain steps of methods described may be removed, others may be added, and the sequence of steps may be altered. It is also to be understood that the description and the claims drawn to a method may include some indication in reference to certain steps. However, the indication used is only to be viewed for identification purposes and not as a suggestion as to an order for the steps.
Number | Date | Country | Kind |
---|---|---|---|
201010266865.4 | Aug 2010 | CN | national |