datastore

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2020 License: Apache-2.0 Imports: 1 Imported by: 3

README

FreeTAXII/libstix2/datastore

Design Problem 1

When designing a relational database for STIX content, one might decide to make a different table for each SDO. This would make sense, since each object in STIX has different properties. However, doing this will require sub-tables for things like "labels" to be created for every single SDO table that is created.

If you tried to do this without creating a separate "labels" tables for each SDO there would be no easy way to link them back to the right row in the right table.

Let me explain...

One could not simply use the ROWID, as the ROWID would not be unique across SDO tables. You could also not just use the STIX ID, as different versions of the object will have different rows in the database. You would need some sort of deterministic ID or hash that is based on the STIX ID and the STIX modified timestamp (and maybe something else). You would also need to record the table name that the record was located in, otherwise you would need to search every table for the record in question (or keep a master index table some how).

My Solution

The way I have decided to solve this problem is to create a base table that contains just the common properties that are part of every STIX object (SDO and SRO). This will then allow me to link all of the SDO Tables and extra sub-tables directly to this base table. Yes, this means that every addition to the database will result in multiple transactions, since you will need to get the right ID value for the base table record insertion to add that as a foreign ID in the corresponding SDO table or sub-table.

License

This is free software, licensed under the Apache License, Version 2.0.

Copyright 2015-2019 Bret Jordan, All rights reserved.

Documentation

Overview

Package datastore defines various datastores for use with STIX 2 and TAXII 2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastorer

type Datastorer interface {
	Close() error
	AddObject(obj interface{}) error
	AddTAXIIObject(obj interface{}) error
	AddToCollection(collectionid, stixid string) error
	GetObjects(query collections.CollectionQuery) (*collections.CollectionQueryResult, error)
	GetVersions(query collections.CollectionQuery) (*collections.CollectionQueryResult, error)
	GetManifestData(query collections.CollectionQuery) (*collections.CollectionQueryResult, error)
}

Datastorer - This interface enables access to the STIX/TAXII datastore.

Close - This will close the connection to the datastore GetObject - This takes in a STIX ID and modified timestamp and returns a specific STIX object AddObject - This takes in a STIX object and writes it to the datastore AddTAXIIObject - This takes in a TAXII object and writes it to the datastore GetBundle - This will return a STIX Bundle object based on the query parameters provided GetManifestData - This will return a TAXII Manifest resource based on the query parameters provide

Directories

Path Synopsis
Package sqlite3 implements the SQLite 3 datastore for TAXII 2.
Package sqlite3 implements the SQLite 3 datastore for TAXII 2.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL