Documentation ¶
Index ¶
- Variables
- type Attribute
- func (a *Attribute) AddFailedReason(attributeID, reason, dataset string)
- func (a *Attribute) ConsumerForm(m *Metadata) string
- func (a Attribute) Darc(calypsoWriteID string) string
- func (a Attribute) Form() string
- func (a Attribute) FoundName(name string) bool
- func (a *Attribute) GetActiveAttributesByRuleType(ruleType string) []*Attribute
- func (a *Attribute) GetAttribute(id string) (*Attribute, bool)
- func (a *Attribute) GetAttributeByValue(value string) (*Attribute, bool)
- func (a *Attribute) GetAttributesByName(name string) []*Attribute
- func (a Attribute) HasFailedReasons() bool
- func (a Attribute) HasFilledSubattributes() bool
- func (a *Attribute) Reset()
- func (a *Attribute) ResetFailedReasons()
- func (a Attribute) String() string
- func (a *Attribute) TryUpdate(key, val string)
- type AttributesGroup
- type AuditBlock
- type AuditData
- type AuditTransaction
- type CatalogData
- type Dataset
- type DelegatedEnforcement
- type EnforcementAttribute
- type FailedReason
- type FailedReasons
- type Metadata
- func (m Metadata) Darc(calypsoWriteID string) string
- func (m Metadata) FoundName(name string) bool
- func (m Metadata) GetActiveAttributesByRuleType(ruleType string) []*Attribute
- func (m Metadata) GetAttribute(id string) (*Attribute, bool)
- func (m Metadata) GetAttributeByValue(value string) (*Attribute, bool)
- func (m Metadata) GetAttributesByName(name string) []*Attribute
- func (m *Metadata) Reset()
- func (m *Metadata) ResetFailedReasons()
- func (m Metadata) String() string
- func (m *Metadata) TryUpdate(name, val string)
- func (m *Metadata) UpdateOrSet(name, val string)
- type Owner
- func (o *Owner) AddDataset(dataset *Dataset) error
- func (o *Owner) ArchiveDataset(calypsoWriteID string) error
- func (o *Owner) DeleteDataset(calypsoWriteID string) error
- func (o Owner) GetDataset(calypsoWriteID string) *Dataset
- func (o *Owner) ReplaceDataset(calypsoWriteID string, newDataset *Dataset) error
- func (o Owner) String() string
- type Service
Constants ¶
This section is empty.
Variables ¶
var ContractCatalogID = "odysseycatalog"
ContractCatalogID denotes a contract that can store a catalog of owners and datasets
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct { ID string `json:"id"` Description string `json:"description"` Type string `json:"type"` RuleType string `json:"rule_type"` Name string `json:"name"` Value string `json:"value"` // If true the attribute is not enforced automatically by comparing the // attributes in the DARC, but it uses one of the attributes in the // DelegatedEnforcement struct. DelegatedEnforcement bool `json:"delegated_enforcement"` FailedReasons *FailedReasons `json:"failed_reasons"` Attributes []*Attribute `json:"attributes"` }
Attribute ...
func (*Attribute) AddFailedReason ¶
AddFailedReason safely adds a reason to the list of failed reasons
func (*Attribute) ConsumerForm ¶
ConsumerForm is like Form(), but it does not print attributes that have "ManualEnforcment" set to true.
func (Attribute) Darc ¶
Darc outputs a DARC string representation of this attribute. Text field must have uniq ids acroos different datasets, that is why we append the calypsoWriteID. Does NOT browse its sub-attributes
func (Attribute) Form ¶
Form print the HTML field form element of an attribute and its sub attributes
func (*Attribute) GetActiveAttributesByRuleType ¶
GetActiveAttributesByRuleType return the attributes that have the given rule type and that has a value.
func (*Attribute) GetAttribute ¶
GetAttribute return the first attribute found that has the given id
func (*Attribute) GetAttributeByValue ¶
GetAttributeByValue return the first attribute found that has the given id
func (*Attribute) GetAttributesByName ¶
GetAttributesByName return the attributes with the given name
func (Attribute) HasFailedReasons ¶
HasFailedReasons returns true if it has any failed reasons
func (Attribute) HasFilledSubattributes ¶
HasFilledSubattributes checks if any of the sub-aatributes of this attribute has a value. This is convenient to gray out a sub form in case there isn't any sub-attributes filled.
func (*Attribute) Reset ¶
func (a *Attribute) Reset()
Reset reset the value field of this attribute and all its sub-attributes
func (*Attribute) ResetFailedReasons ¶
func (a *Attribute) ResetFailedReasons()
ResetFailedReasons set the FailedReason field of this attribute and its subattributes to an empty slice
type AttributesGroup ¶
type AttributesGroup struct { Title string `json:"title"` Description string `json:"description"` ConsumerDescription string `json:"consumer_description"` Attributes []*Attribute `json:"attributes"` }
AttributesGroup ...
func (AttributesGroup) String ¶
func (ag AttributesGroup) String() string
type AuditBlock ¶
type AuditBlock struct { BlockIndex int // The number of blocks before the previous in the list. If the current block // has an index of 7 and the previous one in the list has an index of 5, then // the delta is 1. This is handy for go templates where we cannot do // aritmetic operations. The first one has a value of -1. DeltaPrevious int // The number of blocks after the next in the list. The last one has a value // of -1. DeltaNext int Transactions []*AuditTransaction }
AuditBlock is a tailored version of a skipblock that we need to display something interesting
type AuditData ¶
type AuditData struct { // BlocksChecked is the number of blocks checked BlocksChecked int // OccFound is the number of blocks concerned OccFound int // Blocks contains the list of audit blocks Blocks []*AuditBlock }
AuditData is used by the catadmin cli to return audit infos
type AuditTransaction ¶
type AuditTransaction struct { Accepted bool Instructions []*byzcoin.Instruction }
AuditTransaction is a tailored version of a transaction for audit
type CatalogData ¶
CatalogData holds the data of the Odyssey catalog contract
func (*CatalogData) AddOwner ¶
func (cd *CatalogData) AddOwner(owner *Owner) error
AddOwner adds a new owner if not already present
func (CatalogData) GetOwner ¶
func (cd CatalogData) GetOwner(identityStr string) *Owner
GetOwner returns the owner if found, or nil
func (*CatalogData) RemoveOwner ¶
func (cd *CatalogData) RemoveOwner(identityStr string) error
RemoveOwner removes an owner from the list of owners
func (CatalogData) String ¶
func (cd CatalogData) String() string
String returns a human readable string representation of the project data
type Dataset ¶
type Dataset struct { CalypsoWriteID string `json:"calypsoWriteID"` Title string `json:"title"` Description string `json:"description"` CloudURL string `json:"cloudURL"` // This is the signer identity that owns the dataset, like 'ed25519:aef123' IdentityStr string `json:"identityStr"` SHA2 string `json:"sha2"` IsArchived bool `json:"is_archived"` Metadata *Metadata `json:"metadata"` }
Dataset describes the metadata of a dataset
func (Dataset) DelegatedForm ¶
DelegatedForm prints the form where the data scientist has to agree on custum text attributes that can not be automatically checked. It fills the value attribute if it finds an attribute that has the same id in the given metadata
type DelegatedEnforcement ¶
type DelegatedEnforcement struct { Title string `json:"title"` Description string `json:"description"` Attributes []*EnforcementAttribute `json:"attributes"` }
DelegatedEnforcement describes attributes that validates other attributes (normally the ones that have the "delegated_enforcement" attribute to true)
func (DelegatedEnforcement) String ¶
func (m DelegatedEnforcement) String() string
type EnforcementAttribute ¶
type EnforcementAttribute struct { ID string `json:"id"` Description string `json:"description"` ValueFromID string `json:"value_from_id"` TriggerID string `json:"trigger_id"` TriggerValue string `json:"trigger_value"` CheckValidates []string `json:"check_validates"` TextValidates string `json:"text_validates"` }
EnforcementAttribute is a particular type of attribute that valides other attributes. It is only a check box that, one checked, whill validates the attributes contained in the "Validates" field.
func (EnforcementAttribute) String ¶
func (e EnforcementAttribute) String() string
type FailedReason ¶
type FailedReason struct { AttributeID string `json:"attribute_id"` Reason string `json:"reason"` Dataset string `json:"dataset"` }
FailedReason describes a failed reason for a specific attribute
func (FailedReason) String ¶
func (f FailedReason) String() string
String returns the string representation of a failed reason
type FailedReasons ¶
type FailedReasons struct {
FailedReasons []*FailedReason `json:"failed_reasons"`
}
FailedReasons is a simple struct that holds a list a failed reasons
func (*FailedReasons) AddReason ¶
func (f *FailedReasons) AddReason(attributeID, reason, dataset string)
AddReason adds a reason to the list of failed reasons
func (FailedReasons) IsEmpty ¶
func (f FailedReasons) IsEmpty() bool
IsEmpty returns true if there is
func (FailedReasons) String ¶
func (f FailedReasons) String() string
type Metadata ¶
type Metadata struct { AttributesGroups []*AttributesGroup `json:"attributesGroups"` DelegatedEnforcement *DelegatedEnforcement `json:"delegated_enforcement"` }
Metadata is a struct that holds a list of attributes groups. This was necessary to use a struct in order to marshal/unmarshal it.
func (Metadata) Darc ¶
Darc print the DARC representation of the metadata. Outputs something like "attr:allowed:ID1=value1&ID2=value2& attr:must_have:ID2=value2&ID3=value3"
func (Metadata) GetActiveAttributesByRuleType ¶
GetActiveAttributesByRuleType return all the attributes that has the given rule type and a non-empty value.
func (Metadata) GetAttribute ¶
GetAttribute return the first attribute that has the given id, and a bool that says if one was found.
func (Metadata) GetAttributeByValue ¶
GetAttributeByValue return the first attribute that has the given value, and a bool that says if one was found.
func (Metadata) GetAttributesByName ¶
GetAttributesByName return the attributes with the given name
func (*Metadata) Reset ¶
func (m *Metadata) Reset()
Reset reset the value field of all the attributes
func (*Metadata) ResetFailedReasons ¶
func (m *Metadata) ResetFailedReasons()
ResetFailedReasons sets the FailedReasons field of every attribute to an empty slice
func (*Metadata) UpdateOrSet ¶
UpdateOrSet update an attribute, if the name is found, by the value, or create a new attribute
type Owner ¶
type Owner struct { Firstname string Lastname string Datasets []*Dataset // This is the signer identity, like 'ed25519:aef123' IdentityStr string }
Owner describes someone that has one or more datasets
func (*Owner) AddDataset ¶
AddDataset adds a dataset if it doesn't already exist
func (*Owner) ArchiveDataset ¶
ArchiveDataset set the IsArchived attribute and removes its attributes
func (*Owner) DeleteDataset ¶
DeleteDataset deletes the dataset at the given calypsoWriteID
func (Owner) GetDataset ¶
GetDataset return the dataset if found, or nil
func (*Owner) ReplaceDataset ¶
ReplaceDataset replace the dataset at the given calypsoWriteID by the newDataset