Data Structure

Basic Overview

Data records are the basis of what makes TozStore. You can store any data you'd like as part of these record structures and work much like a NoSQL store. However, there are some key differences you should consider when developing your application. Records are stored with a record type which is a string value provided at write time which helps you group your data. Record types are essentially a way to represent a collection of certain kinds of records.

Data

It's important to know what pieces of your data are encrypted when using TozStore. Let's take a look at an example using Social Security Numbers. In the code snippet below we've got an object that holds sensitive information that needs to be encrypted and stored.

{ "person" : "Jon Snow", "ssn" : "555-33-2222" }

When writing this to TozStore you may call our write function like so:

client.write("person", {"name":"Jon Snow","ssn" : "555-33-2222"})

In the code example above we've said that the record type is "person" and the data is a key value set that includes "name" and "ssn". The field names "name" and "ssn" are not encrypted while the person's name and actual SSN are encrypted.

Metadata

TozStore also allows you to pass in a third argument we call metadata. This data is also stored unecrypted which allows you to query against it. This makes it easy to find data based on information about the record without needing to expose the sensitive information directly. Let's expand our example.

client.write("person", {"name":"Jon Snow","ssn" : "555-33-2222"},{ "house" : "stark"})

Now that we've added a key value set of data as metadata we can query for all of our records that are of "house" key equal to "stark". You can include any number of key:value pairs when writing records.

Last updated