CN117573780A - Data storage method, device and storage medium - Google Patents

Data storage method, device and storage medium Download PDF

Info

Publication number
CN117573780A
CN117573780A CN202311729336.7A CN202311729336A CN117573780A CN 117573780 A CN117573780 A CN 117573780A CN 202311729336 A CN202311729336 A CN 202311729336A CN 117573780 A CN117573780 A CN 117573780A
Authority
CN
China
Prior art keywords
data
identification information
equipment
event
event identification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311729336.7A
Other languages
Chinese (zh)
Inventor
王妙玉
黄伟
周亮
吴宁泉
欧宝星
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Hotata Smart Home Co Ltd
Original Assignee
Guangdong Hotata Smart Home Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Hotata Smart Home Co Ltd filed Critical Guangdong Hotata Smart Home Co Ltd
Priority to CN202311729336.7A priority Critical patent/CN117573780A/en
Publication of CN117573780A publication Critical patent/CN117573780A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a data storage method, a data storage device and a storage medium, and relates to the technical field of data storage. The data storage method comprises the following steps: the method comprises the steps of receiving record data uploaded by a data sending terminal aiming at an occurred target event, and obtaining equipment type information of the data sending terminal; event identification information corresponding to the record data is obtained according to the equipment type information, and the record data is stored according to the event identification information. According to the embodiment of the application, the event identification information corresponding to the recorded data can be used for data storage, the situation that the stored data need to be compared one by one is avoided, the calculation amount and the data storage cost are reduced, the application can adapt to different types of data sending terminals, the possibility of repeated data storage is reduced, and the equipment use experience is improved.

Description

Data storage method, device and storage medium
Technical Field
The present application relates to the field of data storage technologies, and in particular, to a data storage method, device and storage medium.
Background
With the development of intelligent devices and the need of intelligent device management, a large number of intelligent devices (such as intelligent door locks, intelligent clothes hangers and the like) start to upload data generated by the intelligent devices to a cloud in an online and offline mode so as to store the data in a cloud storage mode.
In the data storage process, the equipment may have the problem of repeated data uploading and repeated data storage due to various problems. To eliminate this problem, it is necessary to compare whether or not the content is consistent with the stored data one by one every time it is stored to eliminate duplicate data, greatly increasing the calculation amount and the data storage cost. In addition, due to the differences of manufacturers, production time, used firmware versions and the like, parameters such as data formats, data types and the like of uploading data of different intelligent devices can also be different, and further different comparison modes (such as encrypting the data uploaded by the first device, decrypting the data and then comparing the content, and the second device is different in data format of recording data when different operations are executed or uploading the data in different uploading modes and then comparing the content after being adjusted to a uniform format) are needed for different intelligent devices, so that difficulty is further increased for data searching and re-working. In conclusion, the problem that repeated storage of data is difficult is eliminated, careless mistakes are easy to occur, so that when a user inquires stored data, the repeated data generates illusion of equipment false start or faults, and equipment use experience is reduced.
Disclosure of Invention
The embodiment of the application provides a data storage method, a data storage device and a storage medium, which can solve the problems of high difficulty in eliminating repeated data storage and easy occurrence of careless mistakes. To achieve this object, embodiments of the present application provide the following solutions.
According to an aspect of the embodiments of the present application, there is provided a data storage method, for a data receiving end connected to a data sending end, including:
receiving record data uploaded by a data transmitting end aiming at an occurred target event, and acquiring equipment type information of the data transmitting end, wherein the equipment type information comprises information indicating that the data transmitting end is a first equipment or a second equipment;
and acquiring event identification information corresponding to the recorded data according to the equipment type information, and storing the recorded data according to the event identification information, wherein the event identification information is used for identifying the recorded data, and the data types of the event identification information used for identifying the recorded data of the first equipment and the second equipment are different.
In one possible implementation manner, receiving the record data uploaded by the data sending end for the occurred target event includes:
Recording data uploaded by a data transmitting end through a transmitting channel is received;
the record data is generated by the data transmitting end according to the triggered target event, the transmitting channel comprises at least one of an online channel and an offline channel, the selection of the transmitting channel is determined by a data transmission state, and the data transmission state comprises at least one of reporting waiting time and a network state.
In one possible implementation manner, the acquiring, according to the device type information, event identification information corresponding to the record data includes:
if the equipment type information indicates that the data transmitting end is the first equipment, acquiring event identification in the recorded data, wherein the event identification is formed by self-proliferation based on the number of triggered events;
and if the equipment type information indicates that the data transmitting end is the second equipment, acquiring a time stamp corresponding to the recorded data according to the transmitting channel of the recorded data.
In one possible implementation manner, if the event identification information is an event identification, storing the record data according to the event identification information includes:
generating an execution statement according to the event identifier, and calling a storage object for storing the record data to execute the execution statement so as to store the record data;
If the event identification information is a timestamp, storing the record data according to the event identification information includes:
and determining a time query range according to the time stamp, and storing the record data into a storage object corresponding to the record data if the storage object corresponding to the record data in the time query range is determined to have no data matched with the record data.
In one possible implementation manner, the obtaining the device type information of the data sending end includes:
acquiring identification information of the data transmitting end, wherein the identification information comprises at least one of a model number and a firmware version of the data transmitting end;
and determining the equipment type information of the data transmitting end according to the identification information.
According to an aspect of the embodiments of the present application, there is provided a data storage method, for a data transmitting end connected to a data receiving end, including:
and uploading recorded data corresponding to the target event to a data receiving end in response to the occurred target event, so that the data receiving end acquires equipment type information of the data transmitting end aiming at the recorded data, then acquires event identification information corresponding to the recorded data according to the equipment type information, and stores the recorded data through the event identification information, wherein the equipment type information comprises information indicating that the data transmitting end is a first equipment or a second equipment, the event identification information is used for identifying the recorded data, and the data types of the event identification information of the first equipment and the second equipment are different.
In one possible implementation manner, the uploading the record data corresponding to the target event to the data receiving end includes:
reporting record data, and acquiring reporting waiting time corresponding to the record data according to response information of the data receiving end;
if the report waiting time is determined to be longer than the preset time, the recorded data are put into a waiting queue, the recorded data in the waiting queue are uploaded according to the network state, and the recorded data in the waiting queue are processed according to the response information of the data receiving end.
According to an aspect of an embodiment of the present application, there is provided a data storage device including:
the device comprises a record data receiving module, a record data processing module and a record data processing module, wherein the record data receiving module is used for receiving record data uploaded by a data sending end aiming at an occurred target event and acquiring device type information of the data sending end, and the device type information comprises information indicating that the data sending end is a first device or a second device;
the storage module is used for acquiring event identification information corresponding to the recorded data according to the equipment type information, and storing the recorded data according to the event identification information, wherein the event identification information is used for identifying the recorded data, and the data types of the event identification information used for identifying the recorded data of the first equipment and the second equipment are different;
Or (b)
And the record data uploading module is used for responding to the generated target event, uploading record data corresponding to the target event to a data receiving end, so that the data receiving end obtains the equipment type information of the data transmitting end aiming at the record data, then obtains event identification information corresponding to the record data according to the equipment type information, and stores the record data through the event identification information, wherein the equipment type information comprises information indicating that the data transmitting end is a first equipment or a second equipment, the event identification information is used for identifying the record data, and the data types of the event identification information of the first equipment and the second equipment are different.
According to one aspect of the present application, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory, the processor executing the computer program to carry out the steps of the method as described above.
According to an aspect of the embodiments of the present application, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method as described above.
The beneficial effects that technical scheme that this application embodiment provided brought are:
on the one hand, the application provides a data storage method, specifically, record data uploaded by a data sending end aiming at an occurred target event is received, equipment type information of the data sending end is obtained, event identification information corresponding to the record data is obtained according to the type information of the data sending end, and the record data is stored according to the event identification information. After acquiring the record data uploaded by the data transmitting end aiming at the target event, acquiring event identification information corresponding to the equipment type information of the data transmitting end in the record data, and storing the record data according to the event identification information. According to the method and the device, the data can be stored through the event identification information corresponding to the recorded data uploaded by the data sending terminals of different device types, the situation that content comparison is needed one by one when the stored data appears is avoided, the calculated amount and the data storage cost are reduced, the method and the device can adapt to the data sending terminals of different types, the difficulty of repeated data storage is eliminated, the possibility that a user inquires the repeated data is reduced, and the device use experience is improved.
On the other hand, the application provides a data storage method, specifically, a data sending end responds to an occurred target event, and uploads record data corresponding to the target event to a data receiving end, so that after the data receiving end obtains equipment type information of the data sending end aiming at the record data, event identification information corresponding to the record data is obtained according to the equipment type information, and the record data is stored through the event identification information. According to the embodiment of the application, the data transmitting terminal with the information of different equipment types transmits the corresponding recorded data of the event to the data receiving terminal based on the corresponding event identification information, so that the data receiving terminal can store the recorded data according to the event identification information corresponding to the recorded data, the calculation amount and the data storage cost are reduced by comparing the content one by one, the data transmitting terminal can adapt to the data transmitting terminal of different types, the difficulty of repeated data storage is eliminated, the possibility that a user inquires the repeated data is reduced, and the equipment use experience is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly describe the drawings that are required to be used in the description of the embodiments of the present application.
Fig. 1 is a flowchart of a data storage method for a data receiving end according to an embodiment of the present application;
fig. 2 is a connection diagram of a data receiving end and a data transmitting end provided in an embodiment of the present application;
fig. 3 is a flowchart of a data storage method for a data sending end according to an embodiment of the present application;
FIG. 4 is a block diagram of a data storage device according to an embodiment of the present application;
FIG. 5 is another block diagram of a data storage device according to an embodiment of the present application;
fig. 6 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the drawings in the present application. It should be understood that the embodiments described below with reference to the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application, and the technical solutions of the embodiments of the present application are not limited.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and "comprising," when used in this application, specify the presence of stated features, information, data, steps, operations, elements, and/or components, but do not preclude the presence or addition of other features, information, data, steps, operations, elements, components, and/or groups thereof, all of which may be included in the present application. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein indicates at least one of the items defined by the term, e.g. "a and/or B" indicates implementation as "a", or as "a and B".
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the following detailed description of the embodiments of the present invention will be given with reference to the accompanying drawings.
The technical solutions of the embodiments of the present invention and technical effects produced by the technical solutions of the present invention are described below by describing several exemplary embodiments. It should be noted that the following embodiments may be referred to, or combined with each other, and the description will not be repeated for the same terms, similar features, similar implementation steps, and the like in different embodiments.
The data storage method, device and storage medium provided by the application aim to solve at least one technical problem existing in the prior art.
In this embodiment of the present application, as shown in fig. 1-fig. 2, a data storage method is provided, where the data storage method is used for a data receiving end communicatively connected to at least one data sending end, where the data sending end may be an intelligent door lock, an intelligent clothes hanger, an intelligent television, an intelligent watch, and other objects (electronic devices) that need to store recorded data, and the data receiving end may be a server, a cloud platform, and other objects (electronic devices) that can store recorded data.
Optionally, the data receiving end and the data sending end can be in communication connection in a wireless manner such as WiFi, bluetooth, zigBee and the like, and can also perform data transmission through a data line, a network cable or other data transmission lines.
Optionally, the data receiving end stores the record data uploaded by the data receiving end in a cloud storage mode. The cloud storage is a new concept which extends and develops in the concept of cloud computing (closed computing), and refers to a system which integrates a large number of different types of storage devices in a network through application software to cooperatively work and provides data storage and service access functions together through functions of cluster application, grid technology or a distributed file system and the like. When the core of the operation and the processing of the cloud computing system is the storage and the management of a large amount of data, a large amount of storage devices need to be configured in the cloud computing system, and then the cloud computing system is converted into a cloud storage system, so that the cloud storage is a cloud computing system with the data storage and the management as the core. The cloud computing system can solve the problem that the data transmitting end is small in storage space and difficult to store data in large quantity, promote intelligent development of the data receiving end, and reduce manufacturing cost of the data receiving end.
The following describes a data storage method executed by the data receiving end in the embodiment of the present application with reference to fig. 1, specifically, S101 to S102 are included:
s101: and receiving the record data uploaded by the data transmitting end aiming at the generated target event, and acquiring the equipment type information of the data transmitting end.
Optionally, receiving the record data uploaded by the data sending terminal for the occurred target event includes: recording data uploaded by a data transmitting end through a transmitting channel is received; the record data is generated by the data transmitting end according to the triggered target event, the transmitting channel comprises at least one of an online channel and an offline channel, the selection of the transmitting channel is determined by a data transmission state, and the data transmission state comprises at least one of reporting waiting time and a network state. The data transmitting end may select to upload recorded data through the online channel after the data transmission state satisfies a preset condition (such as reporting waiting time (time from the end of uploading to the time of receiving response information of the data receiving end) is less than a preset value (e.g., 1 second), and the network state is clear (such as uploading speed is greater than 1M per second)), and select to upload recorded data using the offline channel when the preset condition is not satisfied. The efficiency of data reporting is improved by combining an online channel and an offline channel.
After a target event occurs, the data receiving end generates recording data according to the target event, and transmits the recording data to the data receiving end along a data transmission path between the data receiving end and the data transmitting end. After receiving the record data, the data receiving end identifies the data transmitting end corresponding to the record data and acquires the equipment type information of the data transmitting end.
In one embodiment, the device type information includes information indicating that the data transmitting end is the first device or the second device. Specifically, the first device is a new device, the second device is an inventory device (i.e., a device which does not support OTA upgrade, cannot be upgraded or has high upgrade difficulty (such as a specific device is required to perform upgrade, and the upgrade step is complicated) is present), the data type of the record data uploaded by the inventory device is fixed, and then the data type of the event identification information for identifying the record data is fixed. The new device may be a data transmitting terminal satisfying a first condition, the stock device is a data transmitting terminal not satisfying the first condition, and the first condition is that the condition determined according to the characteristics of the stock device includes at least one of a model number of a preset model number, a firmware version higher than a preset version, and a production time later than a preset time. If the equipment type information cannot be acquired, query information is sent to a preset management object, and the equipment type information of the data sending end is determined according to feedback of the preset management object.
The new device and the stock device can use event identification information of different data types to identify the uploaded record data, and the event identification information corresponding to each record data is unique. For example, the event ID is used as event identification information related to the record data uploaded by the new device, the timestamp is used as event identification information related to the record data uploaded by the stock device, the event identification information can be stored in the record data, can be uploaded to the data receiving end together with the record data, and can be automatically generated by the data receiving end according to the record data uploaded by the data sending end and the device type information (for example, the data receiving end can generate event identification information corresponding to the record data according to at least one of the uploading time of the record data, the device number of the data sending end, the position of the data sending end, the event type corresponding to the record data and the event occurrence time).
The data receiving end can select corresponding event identification information according to the equipment type of the data transmitting end for uploading recorded data. After receiving the record data, acquiring the equipment type information of the data transmitting end, and searching event identification information according to the equipment type information of the data transmitting end.
In one embodiment, the data receiving end may also analyze the record data after receiving the record data, and determine the device type information of the data sending end according to the event identification information in the record data. If the record data uploaded by one device comprises an event ID, the data transmitting end is the first device. If the record data uploaded by the data transmitting end does not include the event ID, the data transmitting end is the second device. In addition, in order to facilitate generation of an event ID and discrimination of event IDs of different events, the event ID may be self-increased with the occurrence number of events (the event ID of the next event is obtained by adding 1 to the last event ID), and the event identification information corresponding to the stock device may be a timestamp. The time stamp can also be used as an event identifier to be added into the record data corresponding to the first device.
Optionally, the data transmitting end may generate the record data after the specified event occurs, or may use each operation triggered by the data transmitting end as a target event, so as to generate the record data corresponding to the target time.
In one embodiment, the data transmitting end is an intelligent door lock, and the intelligent door lock generates event-related record data when any event such as a door opening event, a door non-closing event, ringing, low-power warning, locking bolt clamping, anti-theft operation and the like occurs.
Optionally, the data sending end may send all the recorded data to the same data receiving end, or may select the data receiving end that receives the recorded data according to the type of the target event or the idle state of the data receiving end (for example, whether there is a sufficient storage space, whether the data transmission channel corresponding to the data receiving end is congested, whether a response signal of the data receiving end is received, and the like, which reflects the information that the data can be stably transmitted at present).
Optionally, after the data sending end generates the target event, the record corresponding to the target event is immediately uploaded to the data receiving end, or the number of generated record data or the current time period of detection can be calculated, if the number reaches the preset number or the time period is located in the preset time period, the record data is uploaded to the data receiving end. And the recorded data can be uploaded to the data receiving end after the data uploading instruction is received.
In one embodiment, a report waiting time is preset (for example, the report waiting time is preset to be 1 second), the data receiving end is a cloud end, the data transmitting end uploads recorded data through an online channel, detects whether successful uploading response information of the data receiving end is received, and uploads next recorded data if the response information is received. If the uploading is detected to be finished until the response information is not received currently and the time interval between the uploading finish and the current time interval is larger than or equal to the preset reporting waiting time, the recorded data is put into a queue which is uploaded offline, and then the recorded data is uploaded through an offline channel. (the advantage of this is that the report result of one record data is not uncertain, so that the communication of other record data by using an online channel is influenced, and the timeliness of the network under normal conditions is ensured), wherein when the record data is put into a queue, the occurrence time of an event corresponding to the record data can be stored in the record data.
And the data receiving end can start an off-line reporting thread to communicate with the data receiving end after the recorded data is put into the queue for a preset time or within a preset time period, if the network is determined to be clear, the recorded data is taken out from the corresponding queue through the off-line and reported one by one, and the recorded data in the queue is deleted after the data receiving end (cloud) is required to wait for successful response during reporting.
Optionally, acquiring the device type information of the data sending end includes: acquiring identification information of a data transmitting end, wherein the identification information comprises at least one of a model number and a firmware version of the data transmitting end; and determining the equipment type information of the data transmitting end according to the identification information.
Optionally, the identification information may further include at least one of manufacturer, production time, etc. of the data sending end, where the at least one is used to indicate that the data sending end is the first device or the second device, and the data receiving end may store a correspondence between different device type information and the first device or the second device, and determine a type of the data sending end based on the correspondence. The identification information can be stored in the recorded data, or the data can be recorded by the data receiving end, the inquiry request is sent to the data sending end, and the identification information is obtained according to the data fed back by the data sending end based on the inquiry request.
Optionally, the data receiving end may obtain the device type information of the data sending end according to at least one of a format of the record data, a port for receiving the record data, and an uploading time of the record data. The recorded data may also be parsed to obtain device type information based on one or more of device type information, device number, device model number, firmware version, and other information recorded by the recorded data.
Optionally, the identification information may also be stored in the data receiving end, where the data receiving end queries the identification information of the data sending end according to the flag information (such as the number, address, etc. of the data sending end) in the record data.
In one embodiment, the identification information is a firmware version, the first device is a new device installed with a specific type of firmware version, the second device is an inventory device not installed with the specific type of firmware version, and the firmware version of the data transmitting end is obtained by recording data. The data receiving end obtains the device type information of the data transmitting end uploading the recorded data according to the pre-stored corresponding relation information (such as a corresponding table) between the firmware version and the first device and the second device.
Optionally, the data receiving end may further acquire event identification information of the record data, and obtain device type information of the data sending end through the event identification information. Specifically, if the record data includes event identification information related to the first device, the data transmitting end is determined to be the first device.
S102: event identification information corresponding to the record data is obtained according to the equipment type information, and the record data is stored according to the event identification information.
Optionally, the event identification information to be acquired by the data sending terminals of different types is different, so as to adapt to the different data sending terminals, and the event identification information corresponding to the record data is acquired according to the equipment type information, including: if the equipment type information is determined to indicate that the data transmitting end is the first equipment, acquiring event identification in the recorded data, wherein the event identification is self-proliferated based on the number of triggered events; if the equipment type information indicates that the data transmitting end is the second equipment, acquiring a timestamp corresponding to the recorded data according to a transmitting channel of the recorded data.
Optionally, event identification information is obtained according to the device type information, where the event identification information may be stored in the record data, or may be stored outside the record data, and after the record data is received by the data receiving end, the data receiving end queries a specified object (such as a data sending end that sends the record data or other objects storing the event identification information). And the data receiving end detects whether record data corresponding to the event identification information is stored currently or not according to the event identification information. If it is determined that the record data is stored, the record data is not stored any more, and if it is determined that the record data is not stored, the record data is stored.
Optionally, the event identification information may further include at least one of an event name, a number of a data transmitting end, an occurrence time, an event type, and other information capable of identifying the occurrence time, which is not limited herein.
In one embodiment, the event identification information corresponding to the first device is an event ID, and is an event ID generated by the data sending end of the first device after occurrence of a target event, where the event IDs of different target events are different and unique, and the event ID is self-increased according to the event triggering times. Specifically, the event ID may be a number whose change interval is 1-65535, and is cyclically changed based on the interval. The event ID is stored in the logging data and the logging data uploaded must carry the event ID, whether via an online channel or an offline channel.
In one embodiment, the event identification information corresponding to the second device is a timestamp, and is that the data transmitting end of the second device uploads recorded data when an event occurs, when the recorded data is uploaded through an online channel, the data receiving end generates a timestamp according to the time of uploading the recorded data, when the recorded data is uploaded through an offline channel, the data transmitting end stores the event occurrence time into the recorded data, and the data receiving end generates the timestamp according to the event occurrence time.
Optionally, the data receiving end queries repeated record data and stores the record data in a corresponding mode according to the type of the event identification information, so as to avoid repeated storage of the record data. If the event identification information is an event identification, storing the record data according to the event identification information, including: generating an execution statement according to the event identifier, and calling a storage object storing the record data to execute the execution statement so as to store the record data; if the event identification information is a time stamp, storing record data according to the event identification information, including: and determining a time query range according to the time stamp, and storing the record data into a storage object if the storage object corresponding to the record data in the time query range is determined to have no data matched with the record data.
Optionally, the object for storing the record data is a database, the execution statement may be an SQL statement, and the storing of the record data is achieved by querying whether the record data is stored or not through the SQL statement.
In one embodiment, the data receiving end is a cloud end, the data sending end is an intelligent door lock, the intelligent door lock is a first device, after a door opening event occurs, recorded data is uploaded by the intelligent door lock, the cloud end integrates an event ID in the recorded data reported by the intelligent door lock into a strip which is inserted if the event ID does not exist, an SQL statement is updated if the event ID does not exist, the SQL statement is transmitted to a database, and the database executes the SQL statement to inquire and store the recorded data. The cloud end only interacts with the database once, so that consumption of the server and the database can be saved. Wherein, if not, the "insert is executed, if yes, the" SQL statement is updated, taking MySQL as an example: inser in to TableA xxx for update (where the SQL statement is built, a unique index is built, such as device ID+event ID).
In another embodiment, the device type information is a second device, the data receiving end obtains a timestamp according to the record data (the timestamp is a server timestamp, if the record data is uploaded in an online manner, the server timestamp is obtained according to the uploading time, if the record data is uploaded in an offline manner, the server timestamp is obtained according to the device time (i.e. the event occurrence time) recorded in the record data), and queries whether the database stores the uploaded record data before and after a time point corresponding to the server timestamp (for example, within plus or minus 5 seconds of the time point). If yes, the recorded data is considered to be repeated and is directly discarded; if not, the record data is stored in a database.
After the data storage method acquires the record data uploaded by the data transmitting end aiming at the target time, acquiring event identification information corresponding to the equipment type information of the data transmitting end in the record data, and storing the record data according to the event identification information. According to the embodiment of the application, the event identification information in the recorded data can be used for data storage, the situation that the same recorded data is repeatedly stored is avoided, the application range of the data storage can be expanded by adapting to different types of data sending terminals.
According to an aspect of the present application, there is further provided a data storage method, as shown in fig. 3, for a data transmitting end connected to a data receiving end, the data storage method including:
s201: and in response to the generated target event, uploading the recorded data corresponding to the target event to a data receiving end, so that the data receiving end acquires the equipment type information of a data transmitting end aiming at the recorded data, acquires event identification information corresponding to the recorded data according to the equipment type information, and stores the recorded data through the event identification information.
Optionally, the device type information includes information indicating that the data transmitting end is a first device or a second device, and the first device is different from the second device in data type for identifying event identification information for uploading recorded data. The event identification information is used for identifying the record data, and the event identification information corresponding to the record data is selected according to the equipment type information of the data transmitting end.
Optionally, uploading the record data corresponding to the target event to the data receiving end includes: and generating record data, and uploading the record data according to at least one of the reporting waiting time and the network state.
Uploading the recorded data according to at least one of the reporting waiting time and the network state, wherein the method comprises the following steps: reporting the record data, and acquiring reporting waiting time corresponding to the record data according to response information of a data receiving end; if the reporting waiting time is determined to be longer than the preset time, the recorded data are put into a waiting queue, the recorded data in the waiting queue are uploaded according to the network state, and the recorded data in the waiting queue are processed according to the response information of the data receiving end.
Optionally, uploading the recorded data according to the reporting waiting time and the network state includes:
reporting record data, and acquiring reporting waiting time corresponding to the record data according to response information of the data receiving end;
if the report waiting time is determined to be longer than the preset time, the recorded data are put into a waiting queue, the recorded data in the waiting queue are uploaded according to the network state, and the recorded data in the waiting queue are processed according to the response information of the data receiving end.
Optionally, acquiring event identification information corresponding to the record data according to the device type information includes:
if the equipment type information indicates that the data transmitting end is the first equipment, acquiring event identification in the recorded data, wherein the event identification is formed by self-proliferation based on the number of triggered events;
And if the equipment type information indicates that the data transmitting end is the second equipment, acquiring a time stamp corresponding to the recorded data according to the transmitting channel of the recorded data.
Optionally, if the event identification information is an event identification, storing the record data according to the event identification information includes:
generating an execution statement according to the event identifier, and calling a storage object for storing the record data to execute the execution statement so as to store the record data;
if the event identification information is a timestamp, storing the record data according to the event identification information includes:
and determining a time query range according to the time stamp, and storing the record data into a storage object corresponding to the record data if the storage object corresponding to the record data in the time query range is determined to have no data matched with the record data.
Optionally, acquiring the device type information of the data sending end includes:
acquiring identification information of the data transmitting end, wherein the identification information comprises at least one of a model number and a firmware version of the data transmitting end;
and determining the equipment type information of the data transmitting end according to the identification information.
According to an aspect of the present application, there is further provided a data storage device, as shown in fig. 4, a data transmission device 400 includes a recording data receiving module 401 and a storage module 402. The record data receiving module 401 is configured to receive record data uploaded by a data sending end for an occurred target event, and obtain device type information of the data sending end, where the device type information includes information indicating that the data sending end is a first device or a second device. The storage module 402 is configured to obtain event identification information corresponding to the record data according to the device type information, and store the record data according to the event identification information, where the event identification information is used to identify the record data, and the first device and the second device are different in data type of the event identification information used to identify the record data.
According to an aspect of the present application, as shown in fig. 5, the data storage apparatus 400 further includes a record data uploading module 403, where the record data uploading module 403 is configured to upload record data corresponding to an occurred target event to a data receiving end in response to the occurred target event, so that after the data receiving end obtains device type information of a data sending end for the record data, obtain event identification information corresponding to the record data according to the device type information, and store the record data through the event identification information, where the device type information includes information indicating that the data sending end is a first device or a second device, and the event identification information is used to identify the record data, and a data type of the event identification information used to identify the record data by the first device is different from a data type of the event identification information used to identify the record data by the second device.
In an alternative embodiment, there is provided an electronic device, as shown in fig. 6, the electronic device 4000 shown in fig. 6 includes: a processor 4001 and a memory 4003. Wherein the processor 4001 is coupled to the memory 4003, such as via a bus 4002. Optionally, the electronic device 4000 may further comprise a transceiver 4004, the transceiver 4004 may be used for data interaction between the electronic device and other electronic devices, such as transmission of data and/or reception of data, etc. It should be noted that, in practical applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 is not limited to the embodiment of the present application.
The processor 4001 may be a CPU (central processing unit), a general purpose processor, a DSP (digital signal processor), an ASIC (application specific integrated circuit), an FPGA (field programmable gate array) or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules, and circuits described in connection with this disclosure. The processor 4001 may also be a combination that implements computing functionality, e.g., comprising one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
Bus 4002 may include a path to transfer information between the aforementioned components. The bus 4002 may be a PCI (peripheral component interconnect) bus, an EISA (extended industrial standard architecture) bus, or the like. The bus 4002 can be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The memory 4003 may be a ROM (read only memory) or other type of static storage device that can store static information and instructions, a RAM (random access memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (electrically erasable programmable read only memory), a CD-ROM (compact disc read only memory) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store a computer program and that can be read by a computer, without limitation.
The memory 4003 is used for storing a computer program that executes an embodiment of the present application, and is controlled to be executed by the processor 4001. The processor 4001 is configured to execute a computer program stored in the memory 4003 to realize the steps shown in the foregoing method embodiment.
The electronic device may be any electronic product that can perform man-machine interaction with an object, for example, a personal computer, a tablet computer, a smart phone, a personal digital assistant (PersonalDigitalAssistant, PDA), a game console, an interactive internet protocol television (InternetProtocolTelevision, IPTV), an intelligent wearable device, and the like.
The electronic device may also include a network device and/or an object device. Wherein the network device includes, but is not limited to, a single network server, a server group made up of multiple network servers, or a cloud based on cloud computing (CloudComputing) made up of a large number of hosts or network servers.
The network in which the electronic device is located includes, but is not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VirtualPrivateNetwork, VPN), and the like.
The embodiment of the application provides a computer storage medium, and a computer program is stored on the computer storage medium, and when the computer program is executed by a processor, the steps and corresponding contents of the foregoing method embodiment can be realized.
The terms "first," "second," "third," "fourth," "1," "2," and the like in the description and in the claims of this application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the present application described herein may be implemented in other sequences than those illustrated or otherwise described.
It should be understood that, although the flowcharts of the embodiments of the present application indicate the respective operation steps by arrows, the order of implementation of these steps is not limited to the order indicated by the arrows. In some implementations of embodiments of the present application, the implementation steps in the flowcharts may be performed in other orders as desired, unless explicitly stated herein. Furthermore, some or all of the steps in the flowcharts may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or phases may be performed at the same time, or each of these sub-steps or phases may be performed at different times, respectively. In the case of different execution time, the execution sequence of the sub-steps or stages may be flexibly configured according to the requirement, which is not limited in the embodiment of the present application.
The foregoing is merely an optional implementation manner of the implementation scenario of the application, and it should be noted that, for those skilled in the art, other similar implementation manners based on the technical ideas of the application are adopted without departing from the technical ideas of the application, and also belong to the protection scope of the embodiments of the application.

Claims (10)

1. A data storage method, characterized in that a data receiving terminal for connecting with a data transmitting terminal, comprises:
receiving record data uploaded by a data transmitting end aiming at an occurred target event, and acquiring equipment type information of the data transmitting end, wherein the equipment type information comprises information indicating that the data transmitting end is a first equipment or a second equipment;
and acquiring event identification information corresponding to the recorded data according to the equipment type information, and storing the recorded data according to the event identification information, wherein the event identification information is used for identifying the recorded data, and the data types of the event identification information used for identifying the recorded data of the first equipment and the second equipment are different.
2. The data storage method according to claim 1, wherein receiving the record data uploaded by the data transmitting end for the occurred target event includes:
Recording data uploaded by a data transmitting end through a transmitting channel is received;
the record data is generated by the data transmitting end according to the triggered target event, the transmitting channel comprises at least one of an online channel and an offline channel, the selection of the transmitting channel is determined by a data transmission state, and the data transmission state comprises at least one of reporting waiting time and a network state.
3. The data storage method according to claim 2, wherein the acquiring event identification information corresponding to the recording data according to the device type information includes:
if the equipment type information indicates that the data transmitting end is the first equipment, acquiring event identification in the recorded data, wherein the event identification is formed by self-proliferation based on the number of triggered events;
and if the equipment type information indicates that the data transmitting end is the second equipment, acquiring a time stamp corresponding to the recorded data according to the transmitting channel of the recorded data.
4. A data storage method according to claim 3, wherein,
if the event identification information is an event identification, storing the record data according to the event identification information includes:
Generating an execution statement according to the event identifier, and calling a storage object for storing the record data to execute the execution statement so as to store the record data;
if the event identification information is a timestamp, storing the record data according to the event identification information includes:
and determining a time query range according to the time stamp, and storing the record data into a storage object corresponding to the record data if the storage object corresponding to the record data in the time query range is determined to have no data matched with the record data.
5. The data storage method according to claim 1, wherein the obtaining the device type information of the data transmitting end includes:
acquiring identification information of the data transmitting end, wherein the identification information comprises at least one of a model number and a firmware version of the data transmitting end;
and determining the equipment type information of the data transmitting end according to the identification information.
6. A data storage method, characterized in that a data transmitting terminal for connecting with a data receiving terminal, comprises:
and uploading recorded data corresponding to the target event to a data receiving end in response to the occurred target event, so that the data receiving end obtains equipment type information of the data transmitting end aiming at the recorded data, then obtains event identification information corresponding to the recorded data according to the equipment type information, and stores the recorded data through the event identification information, wherein the equipment type information comprises information indicating that the data transmitting end is a first equipment or a second equipment, the event identification information is used for identifying the recorded data, and the data types of the event identification information of the first equipment and the second equipment are different.
7. The data storage method according to claim 6, wherein uploading the recorded data corresponding to the target event to the data receiving terminal comprises:
reporting record data, and acquiring reporting waiting time corresponding to the record data according to response information of the data receiving end;
if the report waiting time is determined to be longer than the preset time, the recorded data are put into a waiting queue, the recorded data in the waiting queue are uploaded according to the network state, and the recorded data in the waiting queue are processed according to the response information of the data receiving end.
8. A data storage device, comprising:
the device comprises a record data receiving module, a record data processing module and a record data processing module, wherein the record data receiving module is used for receiving record data uploaded by a data sending end aiming at an occurred target event and acquiring device type information of the data sending end, and the device type information comprises information indicating that the data sending end is a first device or a second device;
the storage module is used for acquiring event identification information corresponding to the recorded data according to the equipment type information, and storing the recorded data according to the event identification information, wherein the event identification information is used for identifying the recorded data, and the data types of the event identification information used for identifying the recorded data of the first equipment and the second equipment are different;
Or (b)
And the record data uploading module is used for responding to the generated target event, uploading record data corresponding to the target event to a data receiving end, so that the data receiving end obtains the equipment type information of the data transmitting end aiming at the record data, then obtains event identification information corresponding to the record data according to the equipment type information, and stores the record data through the event identification information, wherein the equipment type information comprises information indicating that the data transmitting end is a first equipment or a second equipment, the event identification information is used for identifying the record data, and the data types of the event identification information of the first equipment and the second equipment are different.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to carry out the steps of the method according to claims 1-7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any of claims 1-7.
CN202311729336.7A 2023-12-14 2023-12-14 Data storage method, device and storage medium Pending CN117573780A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311729336.7A CN117573780A (en) 2023-12-14 2023-12-14 Data storage method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311729336.7A CN117573780A (en) 2023-12-14 2023-12-14 Data storage method, device and storage medium

Publications (1)

Publication Number Publication Date
CN117573780A true CN117573780A (en) 2024-02-20

Family

ID=89893923

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311729336.7A Pending CN117573780A (en) 2023-12-14 2023-12-14 Data storage method, device and storage medium

Country Status (1)

Country Link
CN (1) CN117573780A (en)

Similar Documents

Publication Publication Date Title
US9930632B2 (en) M2M application remote registration method, device, system and storage medium
CN1910563B (en) Device registration system, server, and terminal device
CN111970363B (en) Data processing method and device based on Internet of things
US10834559B2 (en) Information processing method for machine-to-machine/man (M2M) application, common services entity (CSE) and application entity (AE)
US20140058537A1 (en) Methods, Systems, and Products for Controlling Devices
CN106357442A (en) Server cluster monitoring method and system
US11930292B2 (en) Device state monitoring method and apparatus
CN115562757A (en) Data processing method, configuration center system, electronic device, and storage medium
CN111224797A (en) Equipment access method and device and electronic equipment
CN114390044B (en) File uploading method, system, equipment and storage medium
CN108833961B (en) Method, server and system for acquiring flight record data
CN111885103B (en) Resource processing method, server, electronic device and storage medium
CN111831954B (en) Content data updating method, device, computer equipment and storage medium
CN117573780A (en) Data storage method, device and storage medium
CN105281944B (en) Method for setting network protocol address and service management system
CN111209054A (en) Configuration method of terminal equipment, terminal management equipment and electronic equipment
CN111309693A (en) Data synchronization method, device and system, electronic equipment and storage medium
CN111291127B (en) Data synchronization method, device, server and storage medium
CN115883639A (en) Web real-time message pushing method and device, equipment and storage medium
EP4092961A1 (en) Group updating method, message sending method, and apparatuses
CN111581238B (en) Information query method and device, electronic equipment and computer readable storage medium
CN111400327B (en) Data synchronization method and device, electronic equipment and storage medium
CN111241355B (en) Message forwarding method and server
CN113792891B (en) Machine learning feature production system and method
CN117609360A (en) Distributed database management method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination