Background technology
Along with the development of STB, and the perfect and raising of content service, more and more users is hoped and can television program record be got off, the program that some can't in time be watched oneself is recorded in perhaps timed recording.For such functional requirement, with regard to certain problem that needs a large amount of data recording of solution how to store.For in the present STB for the storage of performance recording, mainly contain following two kinds of ways:
First kind of conventional way be with performance recording in USB flash disk, USB portable hard drive or the built-in hard disk of this locality.For this first kind of scheme, in the USB flash disk of this locality, in USB portable hard drive or the built-in hard disk, finite capacity can't be recorded program for a long time with performance recording.Especially high definition program today of popularizing day by day, program record the memory space that more needs super large.Simultaneously, local hard disk has certain probability to be damaged by the lot of data read-write, causes data unreliable.
Second kind. the STB for some network enabled functions can manually be stored into recorded file on the server of network by the user.This second kind of scheme depends on some professional network storage services, can alleviate data capacity and integrity problem to a certain extent, but still there is certain defective in present this way.Because can preset or dispose the network storage server of several specialties in this second method to STB; In order to save memory space; Some specific recorded files can pass on some single servers; Though this server as storage has special personnel to safeguard and uses dedicated hardware, still exists not low failure rate.In order to reduce this failure rate, can with same file transfer to a plurality of servers, back up fully, improved the reliability of data greatly, but the consumption of the redundancy of data and bandwidth is multiplied again, causes the wasting of resources.
And, the STB of network storage function generally is provided in the prior art, all need the user manually recorded file to be transferred on the webserver, because data are huge, the user must restrain oneself long Network Transmission.
Therefore, prior art awaits to improve and development.
Summary of the invention
The technical problem that the present invention will solve is; Above-mentioned defective to prior art; A kind of TV program recording method and system based on STB is provided, provide a kind of real-time, highly reliable, utilize network distributed store method for recording television programs and system, it can reduce the redundancy of data to greatest extent; Can increase substantially data reliability again, and realize easily.
The technical scheme that technical solution problem of the present invention is adopted is following:
A kind of TV program recording method based on STB wherein, comprises step:
When A, STB are recorded TV programme, adopt Erasure Code to encode, and the result data after will encoding disperse to be stored on this locality and the webserver in recording, needing the television programme data of storage.
Said TV program recording method based on STB, wherein, said steps A specifically comprises:
A1, when TV programme being recorded, with needing in recording the television programme data file division of storage to become m data blocks in equal through STB;
A2, this m data blocks in equal encoded obtains n data fragment;
A3, this n data fragment carried out distributed store on the network memory of the local storage of this locality and a plurality of webservers.
Said TV program recording method based on STB; Wherein, It also comprises step: B, in the time need obtaining the data file of these TV programme of recording again; Obtain r available data fragment from local storage and a plurality of network memory, and r available data fragment of this acquisition carried out the original data object that decoding and reconstituting obtains these TV programme of recording, wherein r is more than or equal to m.
Said TV program recording method based on STB; Wherein, Said steps A also comprises: adopt Erasure Code the television programme data that in recording, needs storage to be carried out the coding of linear algebra property; And random length equals the sub-message of origination message in the message behind the coding, all has the coding character that decoding obtains origination message.
Said TV program recording method based on STB, wherein, when adopting Erasure code to carry out uniform enconding, said steps A also comprises:
Definition G does
Matrix, the capable linear independence that is of its any m, G's is any
Submatrix is reversible, and then linear code can be expressed as y=Gx, wherein x=(x
1, x
2... X
m) be source data, be m data blocks in equal, y=(y
1, y
2... Y
n) be the data that obtain behind the coding, be and carry out uniform enconding and obtain n data fragment.
Said TV program recording method based on STB, wherein, said step B also comprises: establish y ' by among the y arbitrarily m data item form, G ' is the submatrix of the capable composition of m accordingly among the G, then have y '=G ' x=; X=G '
-1Y ' accomplishes decode procedure and obtains source data x.
Said TV program recording method based on STB; Wherein, Said steps A also comprises step: unite for the Vandermonde matrix of unit matrix that the structure of generator matrix G adopts
and (
)
or Cauchy matrix and obtain, make any
submatrix of generator matrix G of structure all reversible.
A kind of television program record system based on STB wherein, comprising: STB reaches a plurality of webservers of communicating by letter and being connected with STB;
Said STB comprises:
The recording and storing module when being used for TV programme are recorded, adopt Erasure Code to encode to during recording, needing the television programme data of storage, and the dispersion of the result data after will encoding is stored on this locality and the webserver.
Said television program record system based on STB, wherein, said recording and storing module further comprises:
Divide module unit, be used for when TV programme being recorded, with needing the television programme data file division of storage to become m data blocks in equal in recording through STB;
Coding unit, being used for this m data blocks in equal encoded obtains n data fragment;
The distributed store control unit carries out distributed store with this n data fragment on the network memory of the local storage of this locality and a plurality of webservers.
Said television program record system based on STB, wherein, said STB also comprises:
Data restoring module; Be used in the time need obtaining the data file of these TV programme of recording again; Obtain r available data fragment from local storage and a plurality of network memory; And the r of this acquisition available data fragment carried out the original data object that decoding and reconstituting obtains these TV programme of recording, wherein r is more than or equal to m.
TV program recording method and system based on STB provided by the present invention; Be mainly used in the performance recording of STB, combine local storage medium owing to adopt, and network storage server; Erasure code has been applied in the application of recorded file storage; N the even distributed store of data fragment that the coding back is generated arrives local hard drive, and on the network memory, utilized local storage high stability (having avoided network failure fully) simultaneously; And the high reliability of the network storage (server stores media damage probability is far below local hard drive), be issued to the high availability and the reliability of data at not high data redudancy; Recorded file is encoded and carried out the network distributed store in real time; Broken through the restriction of local hard drive capacity; Make full use of existing very sufficient network storage resource, reduce the redundancy of data to greatest extent, can increase substantially data reliability again; And the present invention carries out data processing and Network Transmission when the performance recording fully simultaneously, has accomplished the user transparently fully, has improved program recording storage efficient greatly, has guaranteed the reliability of storage simultaneously, provides users with the convenient.
Embodiment
The present invention a kind of TV program recording method and system based on STB, clearer, clear and definite for making the object of the invention, technical scheme and advantage, below develop simultaneously embodiment to further explain of the present invention with reference to accompanying drawing.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
A kind of TV program recording method that the embodiment of the invention provides based on STB; When mainly utilizing STB that TV programme are recorded; Adopt Erasure Code to encode, and the result data after will encoding disperse to be stored on this locality and the webserver in recording, needing the television programme data of storage.
In the present embodiment; In conjunction with local storage medium, and network storage server, and use Erasure Code that file is encoded; Result behind the coding is disperseed to be stored on this locality and the webserver; And coding and network transmission process are when performance recording, to carry out simultaneously, and for the user, this coding and network transmission process almost are transparent.Erasure code loses as what a kind of FEC (Forward Error Correction) technology was mainly used in avoiding in the Network Transmission wrapping, and the present invention utilizes Erasure code under the prerequisite that guarantees not high data redudancy and improve reliability of data storage.Specific as follows said.
Being employed among the present invention when carrying out performance recording, encodes to recorded file simultaneously in the backstage, and real-time storage is fully transparent in the user with this behavior of transfer of data to the webserver.Wherein, the TV program recording method that preferred embodiment provides based on STB, as shown in Figure 1, mainly may further comprise the steps:
Step S110, when TV programme being recorded, with needing in recording the television programme data file division of storage to become m data blocks in equal through STB; Referring to Fig. 2, use Erasure code, with needing the TV programme source data (soure data) of storage to be divided into m data blocks in equal in recording.
Step S120, this m data blocks in equal encoded obtains n data fragment; Referring to Fig. 2, this m data blocks in equal encoded through encoder obtains n data fragment.Among this embodiment; Adopt Erasure Code to being divided into the coding that m data blocks in equal carried out linear algebra property in the television programme data that in recording, needs storage; And random length equals the sub-message of origination message in the message behind the coding, all has the coding character that decoding obtains origination message.
Step S130, this n data fragment carried out distributed store on the network memory of the local storage of this locality and a plurality of webservers.
Step S140, in the time need obtaining the data file of these TV programme of recording again; Obtain r available data fragment from local storage and a plurality of network memory; Referring to Fig. 2; And the r of this acquisition available data fragment carried out the original data object m that decoding and reconstituting obtains these TV programme of recording through decoder, wherein r is more than or equal to m.
Adopt Erasure code that multiple implementation is arranged; Use the realization of its linear code (utilizing the coding of linear algebra property) in the present embodiment; And has MDS (maximal distance separable) coding (the sub-message that random length equals origination message in the message behind the coding can decode the coding that obtains origination message be called the MDS coding) character; Be r=m, this paper is r=m as not particularly pointing out.The Code And Decode process of Erasure code has briefly been described like Fig. 2.
The linear code of Erasure code realizes that key is the suitable generator matrix of definition (carrying out the matrix that certain operation realizes coding with source data).
Preferably adopt in the present embodiment; If G is
matrix; The capable linear independence that is of its any m, promptly any
submatrix of G is reversible, and then linear code can be expressed as y=Gx; X=(x1 wherein; X2 ... Xm) be source data, specifically referring to the data blocks in equal of m among Fig. 2; Y=(y1; Y2 ... Yn) data for obtaining behind the coding obtain n data fragment referring to carrying out uniform enconding among Fig. 2.
And establish y ' by among the y arbitrarily m data item forms, G ' is the submatrix of the capable composition of m accordingly among the G, then have y '=G ' x=x=G '-1y ', the completion decode procedure obtains source data x.
The unit matrix that structure for generator matrix G in the present embodiment can use
is united with the Vandermonde matrix of (
)
or Cauchy matrix and is obtained, and obviously any
submatrix of the generator matrix G of structure is all reversible like this.For example: m=3, Vandermonde matrix construction G is used in n=5, then has:
Suppose y
1And y
3Lose and then can obtain vector x completion decoding through following derivation.
The concrete Erasure code Code And Decode program that can use java and the realization of c++ bilingual according to said method.
Therefore; Key point in the embodiment of the invention is exactly with a kind of FEC technology; Erasure code has been utilized in recorded file has been carried out on the distributed storage; And utilize local and two kinds of storages of network simultaneously, utilize the two advantage separately, having reached but has quite high availability of data under the lower data redundancy.And having improved performance recording efficient greatly, the user need not to wait for for a long time again recorded file is transferred on the webserver.
In the present embodiment through Erasure code is improved the reliability of data as a kind of redundancy scheme; Can be regarded as the superset of backup fully and RAID mechanism; (m=1; N=2) Erasure code is equivalent to back up fully, and 5 of RAID can be described as the Erasure code system of (m=4, n=5).
Fully standby system needs too many additional storage capacity for improving the increase redundant data that reliability can only be at double, and the RAID system is not suitable for fault and frequent occasion occurs.The Erasure code that adopts in this enforcement has remedied these defectives, can high reliability and availability be provided through rational extra storage.Especially Erasure code has been applied in the application of recorded file storage; N the even distributed store of data fragment that the coding back is generated arrives local hard drive; And on the network memory; Utilize local storage high stability (having avoided network failure fully) simultaneously, and the high reliability of the network storage (server stores media damage probability is far below local hard drive), be issued to the high availability and the reliability of data at not high data redudancy.
Use Erasure code that file is carried out redundant storage in the present embodiment, can have higher availability than the back mechanism of same redundancy rate.The high availability that Erasure code brings has mainly been utilized the statistics stability of a large amount of individual components, and the height of its availability is directly proportional with total number of chips, is inversely proportional to the needed number of chips of reconstruct.Provided the computing formula of the availability that Erasure code had as follows, as follows:
Wherein,
PBe expressed as the file object usable probability,
nExpression
ForThe number of all fragments behind the file object coding,
mThe number of the needed fragment of expression reconstruct file object,
NExpression
ForThe number of whole machines in the system,
MExpression
ForCurrent disabled machine number in the system.
It is the probability that file object can be used
PEqual to leave in number of chips on the disabled machine be less than (
) the storage means number leave the method number on any machine in than last all fragments.
If 1000 machines are arranged in the system; The failure rate of every machine is 5%; For using (
;
) the system of Erasure code; Calculating availability according to above-mentioned formula (1) is 0.9999999999999986; And for complete standby system, the availability that it has is merely 0.9975.Can find out from these two numerals, same amount of redundancy, the availability that two kinds of systems can reach differs greatly.The tendency of availability of having described as shown in Figure 3 with the variation of data number of chips; Can find out that availability increases along with the increase of data number of chips; Notice that simultaneously working as the data number of chips reaches certain size (
;
) time, every station server failure rate is 5% and had quite approaching availability at 20% o'clock.Just, even we use poor hardware as server configures, through increasing number of servers, equally can reach high availability of data, this also provides more more options for networking stores service merchant.
Based on the foregoing description, the embodiment of the invention also provides a kind of television program record system based on STB, and is as shown in Figure 4, comprising: STB 200 reaches a plurality of webservers 300 of communicating by letter and being connected with STB;
Said STB 200 comprises: recording and storing module, the data restoring module that is connected with this recording and storing module communication.
Said recording and storing module; When being used for TV programme are recorded; Adopt Erasure Code to encode, and the dispersion of the result data after will encoding is stored on this locality and the webserver, specifically as stated to during recording, needing the television programme data of storage.
Wherein, said recording and storing module further comprises:
Divide module unit, be used for when TV programme being recorded, with needing the television programme data file division of storage to become m data blocks in equal in recording through STB; Specifically of above-mentioned step S110.
Coding unit, being used for this m data blocks in equal encoded obtains n data fragment; Specifically of above-mentioned step S120.
The distributed store control unit carries out distributed store with this n data fragment on the network memory of the local storage of this locality and a plurality of webservers, specifically of above-mentioned step S130.
Data restoring module; Be used in the time need obtaining the data file of these TV programme of recording again; Obtain r available data fragment from local storage and a plurality of network memory; And the r of this acquisition available data fragment carried out the original data object that decoding and reconstituting obtains these TV programme of recording, wherein r is more than or equal to m; Specifically of above-mentioned step S150.
In sum; TV program recording method and system based on STB provided by the present invention; Be mainly used in the performance recording of STB, combine local storage medium owing to adopt, and network storage server; Erasure code has been applied in the application of recorded file storage; N the even distributed store of data fragment that the coding back is generated arrives local hard drive, and on the network memory, utilized local storage high stability (having avoided network failure fully) simultaneously; And the high reliability of the network storage (server stores media damage probability is far below local hard drive), be issued to the high availability and the reliability of data at not high data redudancy; Recorded file is encoded and carried out the network distributed store in real time; Broken through the restriction of local hard drive capacity; Make full use of existing very sufficient network storage resource, reduce the redundancy of data to greatest extent, can increase substantially data reliability again; And the present invention carries out data processing and Network Transmission when the performance recording fully simultaneously, has accomplished the user transparently fully, has improved program recording storage efficient greatly, has guaranteed the reliability of storage simultaneously, provides users with the convenient.
Should be understood that application of the present invention is not limited to above-mentioned giving an example, concerning those of ordinary skills, can improve or conversion that all these improvement and conversion all should belong to the protection range of accompanying claims of the present invention according to above-mentioned explanation.