enclave

package
v0.0.0-...-ff244ab Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConductorURL = url.URL{}

	// PrefixerC is exported to easilly pass in dev-mode
	PrefixerC = prefixer.ConductorPrefixer
)

Functions

func AggregateData

func AggregateData(in query.InputDA) (map[string]interface{}, error)

AggregateData leads an aggregation of data

func CreateConcept

func CreateConcept(in *query.Concept, isEncrypted bool) error

CreateConcept checks if concept exists in db. If yes, return error. If no, create the salt, save the concept in db and return the hash.

func CreateConceptInConductorDB

func CreateConceptInConductorDB(in *query.InputCI) error

CreateConceptInConductorDB is used to add a concept to Cozy-DISPERS

func DeleteConcept

func DeleteConcept(in *query.Concept, isEncrypted bool) error

DeleteConcept is used to delete a concept in ConceptIndexor Database.

func GetConcept

func GetConcept(in *query.Concept, isEncrypted bool) error

GetConcept gets a concept from db. If no, return error.

func QueryTarget

func QueryTarget(in query.InputT) error

QueryTarget decrypts instance given by the conductor and build queries

func RetrieveSubscribeDoc

func RetrieveSubscribeDoc(hash []byte) ([]subscribe.SubscribeDoc, error)

RetrieveSubscribeDoc is used to get a Subscribe doc from the Conductor's database. It returns either an empty array of SubscribeDoc or an array of length 1 It returns an error if there is more than 1 subscribe doc.

func SelectAddresses

func SelectAddresses(in query.InputTF) ([]string, error)

SelectAddresses apply the target profile over lists of addresses

func Subscribe

func Subscribe(in *subscribe.InputConductor) error

Subscribe leads the subscription process

Types

type ConceptDoc

type ConceptDoc struct {
	ConceptID  string `json:"_id,omitempty"`
	ConceptRev string `json:"_rev,omitempty"`
	Concept    string `json:"concept,omitempty"`
	Hash       []byte `json:"hash,omitempty"`
	Salt       []byte `json:"salt,omitempty"`
}

ConceptDoc is used to save a concept's salt into Concept Indexor's database hash and salt are saved in byte to avoid string's to be interpreted

func (*ConceptDoc) Clone

func (t *ConceptDoc) Clone() couchdb.Doc

Clone is used to create another ConceptDoc from this ConceptDoc

func (*ConceptDoc) DocType

func (t *ConceptDoc) DocType() string

DocType is used to get DocType

func (*ConceptDoc) ID

func (t *ConceptDoc) ID() string

ID is used to get ID

func (*ConceptDoc) Rev

func (t *ConceptDoc) Rev() string

Rev is used to get Rev

func (*ConceptDoc) SetID

func (t *ConceptDoc) SetID(id string)

SetID is used to set the Doc ID

func (*ConceptDoc) SetRev

func (t *ConceptDoc) SetRev(rev string)

SetRev is used to set Rev

type QueryDoc

type QueryDoc struct {
	QueryID                   string            `json:"_id,omitempty"`
	QueryRev                  string            `json:"_rev,omitempty"`
	IsEncrypted               bool              `json:"encrypted,omitempty"`
	CheckPoints               map[string]bool   `json:"checkpoints,omitempty"`
	Layers                    []query.LayerDA   `json:"layers,omitempty"`
	PseudoConcepts            map[string]string `json:"pseudo_concepts,omitempty"`
	Results                   interface{}       `json:"results,omitempty"`
	EncryptedConcepts         []query.Concept   `json:"concepts,omitempty"`
	EncryptedListsOfAddresses map[string][]byte `json:"enc_instances,omitempty"`
	EncryptedLocalQuery       []byte            `json:"enc_localquery,omitempty"`
	EncryptedTargetProfile    []byte            `json:"enc_operation,omitempty"`
	EncryptedTargets          []byte            `json:"enc_addresses,omitempty"`
}

QueryDoc saves every information about the query. QueryDoc are saved in the Conductor's database. Thanks to that, CheckPoints can be made, and the process can be followed by the querier.

func NewQuery

func NewQuery(in *query.InputNewQuery) (*QueryDoc, error)

NewQuery returns a Query object to lead, resume, get info about the query.

func NewQueryFetchingQueryDoc

func NewQueryFetchingQueryDoc(queryid string, indexLayer int) (*QueryDoc, error)

NewQueryFetchingQueryDoc returns a QueryDoc object to resume the request

func (*QueryDoc) Clone

func (q *QueryDoc) Clone() couchdb.Doc

Clone copy a brand new version of the doc

func (*QueryDoc) DocType

func (q *QueryDoc) DocType() string

DocType returns the doctype

func (*QueryDoc) ID

func (q *QueryDoc) ID() string

ID returns the QueryID

func (*QueryDoc) Lead

func (q *QueryDoc) Lead() error

Lead is the most general method. It will use the 5 previous methods to work. Lead can also be used to resume a query thanks to checkpoints.

func (*QueryDoc) Rev

func (q *QueryDoc) Rev() string

Rev returns the doc's version

func (*QueryDoc) SetID

func (q *QueryDoc) SetID(id string)

SetID set the QueryID

func (*QueryDoc) SetRev

func (q *QueryDoc) SetRev(rev string)

SetRev set the doc's version

func (*QueryDoc) ShouldBeComputed

func (q *QueryDoc) ShouldBeComputed(indexLayer int) (bool, error)

ShouldBeComputed is used by the Conductor to know when to pause/resume/stop the query

func (*QueryDoc) TryToEndQuery

func (q *QueryDoc) TryToEndQuery() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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