Disclosure of Invention
In order to solve the above problems, the present invention provides a cloud space recovery method, which abandons the concept of allocated space in the traditional cloud space recovery, and solves the problem of low allocation rate caused by excessive data in the existing recovery method.
Another object of the present invention is to provide a cloud space recycling apparatus.
The technical scheme adopted by the invention is as follows:
a cloud space recovery method specifically comprises the following steps:
s1, recording user IDs of the first user and the second user respectively;
s2, determining the total available space of the first user and the second user through the user ID;
s3, determining the size of the total available space of the first user and the second user;
s4, adding the size of the total available space of the second user into the residual space of the first user, and deleting the total available space of the second user;
wherein the authority of the first user is higher than the authority of the second user;
the total available space of the first user and the second user is composed of used space and residual space.
As a further improvement of the cloud space recycling method of the present invention, in S4, the total available space of the second user is deleted, specifically:
deleting the total available space of the second user into the recycle bin, and the recycle bin has a revocable function.
As a further improvement of the cloud space recovery method of the present invention, the cloud space recovery method further includes: determining whether the total available space of the user is recycled by judging whether the total available space of the user is accessed within a fixed time, specifically:
judging whether the time when the total available space of the user is not accessed reaches the preset time or not, deleting the total available space of the user to a recycle bin when the time reaches the preset time, and otherwise, reserving the total available space of the user;
wherein the user is a first user or a second user.
As a further improvement of the cloud space recovery method of the present invention, the cloud space recovery method further includes: judging whether the total available space of the user reaches saturation in real time, and if so, increasing the total available space of the user;
wherein the user is a first user or a second user.
As a further improvement of the cloud space recovery method of the present invention, the increase of the total available space is specifically:
adding the total available space of the third user to the total available space of the users whose total available space has reached saturation;
and the third user is the user with the total available space not accessed for the preset time.
As a further improvement of the cloud space recovery method of the present invention, the increase of the total available space is specifically:
adding a reclaimed portion of the total available space reclaimed to the first user to the total available space of the users whose total available space has reached saturation.
As a further improvement of the cloud space recovery method of the present invention, the increase of the total available space is specifically:
the remaining space of the first user is added to the total available space of the users whose total available space has reached saturation.
A cloud space recycling device applying the cloud space recycling method comprises a memory and a processor;
the memory for storing a computer program;
the processor is configured to implement the steps of the cloud space recovery method when executing the computer program.
Compared with the prior art, when the method is implemented, the user IDs of the first user and the second user are respectively recorded, and the total available space of the first user and the total available space of the second user are determined through the user IDs; then determining the size of the total available space of the first user and the second user, adding the size of the total available space of the second user into the residual space of the first user, and deleting the total available space of the second user; wherein the authority of the first user is higher than the authority of the second user; the total available space of the first user and the second user consists of used space and residual space;
the invention limits how the high-authority user recovers the total available space of the low-authority user, and compared with the traditional recovery method, the invention abandons the concept of allocated space, utilizes the change of the total available space to replace the change of the allocated space, and reduces the cost of modifying data in each operation.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the description of the present invention, it is to be understood that the terms "vertical", "lateral", "longitudinal", "front", "rear", "left", "right", "upper", "lower", "horizontal", and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description of the present invention, and do not mean that the device or member to which the present invention is directed must have a specific orientation or position, and thus, cannot be construed as limiting the present invention.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; may be directly connected or indirectly connected through an intermediate. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
Example 1
Embodiment 1 of the present invention provides a cloud space recovery method, as shown in fig. 1, which specifically includes the following steps:
s1, recording user IDs of the first user and the second user respectively;
specifically, the user IDs have uniqueness, and each user ID corresponds to one user;
s2, determining the total available space of the first user and the second user through the user ID;
specifically, determining a total available space corresponding to each user ID;
s3, determining the size of the total available space of the first user and the second user;
specifically, the space size of the total available space of the first user and the second user is determined by querying the mysql database store, for example:
select meta_value from user_meta where meta_key=‘total_size’and user_id=XXX;
s4, adding the size of the total available space of the second user into the residual space of the first user, and deleting the total available space of the second user;
wherein the authority of the first user is higher than the authority of the second user;
the total available space of the first user and the second user is composed of used space and residual space.
It is worth mentioning that: in the present embodiment, the total available space is changeable for each user, the change of the allocated space is replaced with the change of the total available space, and the remaining available space can be calculated by the difference between the total available space and the used space, thereby reducing the cost of modifying data per operation, compared with the conventional technique.
Specifically, the size of the total available space of the second user is added to the remaining space of the first user through the scripting language, such as:
update user_meta set meta_value=XXX where meta_key='total_size'and user_id=XXX。
specifically, the total available space of the second user is deleted by the scripting language, such as:
delete from user_meta where meta_key=‘total_size’and user_id=XXX。
more specifically, when a high-authority user (a first user) recovers a low-authority user (a second user), in order to ensure the consistency of the total amount of user space, the total available space of the high-authority user only needs to be increased, the increase is the total available space of the low-authority user, and at this time, the identity of the low-authority user is also recovered and can be recorded in the total available space with high authority.
In a specific embodiment, no matter how many levels of permissions a user is in, once the total available space of the user is reclaimed by a high-permission user, only the total available space of a low-permission user is added to the total available space or the remaining space of the high-permission user who issued the reclaim command.
In S4, deleting the total available space of the second user, specifically:
deleting the total available space of the deleted second user into a recycle bin, and the recycle bin has a revocable function;
in this way, deletion errors can be prevented from failing to recover by the revocable function of the recycle bin.
The cloud space recovery method further comprises the following steps: determining whether the total available space of the user is recycled by judging whether the total available space of the user is accessed within a fixed time, specifically:
judging whether the time when the total available space of the user is not accessed reaches the preset time or not, deleting the total available space of the user to a recycle bin when the time reaches the preset time, and otherwise, reserving the total available space of the user;
wherein the user is a first user or a second user;
in a specific embodiment, the preset time is 5-30 days;
for example, when the preset time is 5 days, and when the total available space of the user is not accessed for 6 days, the total available space of the user is deleted to the recycle bin.
Therefore, when the data in the total available space of the low-authority user is not used for a long time, the data in the total available space can be released after the data in the total available space is deleted through the script language, so that the total available space of the user can be recycled;
the deleted data can be stored in the recycle bin, and the user can be prevented from mistakenly deleting the data through the withdrawal of the recycle bin;
in another embodiment, when the low-authority user is recycled, only the unused space can be recycled, the used space can not be recycled, and the data in the used space continues to be used by the low-authority user.
The method further comprises the following steps: when the first user allocates the total available space of the first user, the total available space of the first user is reduced, the reduced space size is allocated to the created new user by using the script language, and the space size is used as the total available space of the new user.
The method further comprises the following steps: refreshing the total available space of the first user and the second user when the total available space of the first user and the second user changes;
therefore, the data before the change can be prevented from being displayed because the system is not read again after the data change through timely refreshing.
In another embodiment, the cloud space reclamation method further includes: judging whether the total available space of the user reaches saturation in real time, and if so, increasing the total available space of the user; the user is a first user or a second user;
there are three real-time scenarios for increasing the total available space:
a first scheme of adding the total available space of the third user to the total available space of the users whose total available space has reached saturation; the third user is a user with the total available space not accessed for a preset time;
therefore, the space increase of users with insufficient space can be met, and the space of users who do not use the cloud space for a long time can be recycled, so that resources are fully utilized;
a second scheme of adding a reclamation portion reclaimed to the total available space of the first user to the total available space of the users whose total available space has reached saturation;
therefore, the space increase of users with insufficient space can be met, and the problem of space distribution of recovered low-authority users is solved;
according to the third scheme, the residual space of the first user is added into the total available space of the users of which the total available space is saturated;
therefore, the residual space of the first user is directly allocated, the use of the first user for the space is not influenced, and the space of the user with insufficient space can be increased.
In the embodiment, the total available space of each user in the cloud space is limited and managed, so that the problem that the modified space data is excessive at present is solved, and the allocation rate of allocating the total available space to the new user is indirectly increased.
Example 2
Embodiment 2 of the present invention provides a cloud space recycling apparatus 1, as shown in fig. 2, to which the cloud space recycling method described in embodiment 1 is applied, including a memory 11 and a processor 12;
the memory 11 is used for storing a computer program;
the processor 12 is configured to implement the steps of the cloud space recycling method according to embodiment 1 when executing the computer program.
In addition, a computer program may also be stored on a computer-readable storage medium, which when executed by a processor implements the cloud space reclamation method described in embodiment 1.
The computer-readable access medium includes, but is not limited to, volatile memory and/or non-volatile memory, for example. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc.
It will be understood by those skilled in the art that all or part of the steps of the above methods may be implemented by instructing the relevant hardware through a program, and the program may be stored in a computer readable medium, such as a read only memory, a magnetic or optical disk, and the like. Alternatively, all or part of the steps of the above embodiments may be implemented using one or more integrated circuits. Accordingly, each module/unit in the above embodiments may be implemented in the form of hardware, and may also be implemented in the form of a software functional module. The present disclosure is not limited to any specific form of combination of hardware and software.
The foregoing is illustrative of the present disclosure and is not to be construed as limiting thereof. Although a few exemplary embodiments of this disclosure have been described, those skilled in the art will readily appreciate that many modifications are possible in the exemplary embodiments without materially departing from the novel teachings and advantages of this disclosure. Accordingly, all such modifications are intended to be included within the scope of this disclosure as defined in the claims. It is to be understood that the foregoing is illustrative of the present disclosure and is not to be construed as limited to the specific embodiments disclosed, and that modifications to the disclosed embodiments, as well as other embodiments, are intended to be included within the scope of the appended claims. The present disclosure is defined by the claims and their equivalents.