Commit 951b1a5f authored by Ivar Derksen's avatar Ivar Derksen Committed by Sietse Ringers

Renamed StoreAttribute and StoreAttributes to more relevant names

parent 1acbda2b
...@@ -246,7 +246,7 @@ func (client *Client) addCredential(cred *credential, storeAttributes bool) (err ...@@ -246,7 +246,7 @@ func (client *Client) addCredential(cred *credential, storeAttributes bool) (err
return return
} }
if storeAttributes { if storeAttributes {
err = client.storage.StoreAttribute(id, client.attributes[id]) err = client.storage.StoreAttributes(id, client.attributes[id])
} }
return return
} }
...@@ -270,7 +270,7 @@ func (client *Client) remove(id irma.CredentialTypeIdentifier, index int, storen ...@@ -270,7 +270,7 @@ func (client *Client) remove(id irma.CredentialTypeIdentifier, index int, storen
attrs := list[index] attrs := list[index]
client.attributes[id] = append(list[:index], list[index+1:]...) client.attributes[id] = append(list[:index], list[index+1:]...)
if storenow { if storenow {
if err := client.storage.StoreAttribute(id, client.attributes[id]); err != nil { if err := client.storage.StoreAttributes(id, client.attributes[id]); err != nil {
return err return err
} }
} }
...@@ -330,7 +330,7 @@ func (client *Client) RemoveAllCredentials() error { ...@@ -330,7 +330,7 @@ func (client *Client) RemoveAllCredentials() error {
} }
} }
client.attributes = map[irma.CredentialTypeIdentifier][]*irma.AttributeList{} client.attributes = map[irma.CredentialTypeIdentifier][]*irma.AttributeList{}
if err := client.storage.StoreAttributes(client.attributes); err != nil { if err := client.storage.StoreAllAttributes(client.attributes); err != nil {
return err return err
} }
...@@ -1037,5 +1037,5 @@ func (client *Client) ConfigurationUpdated(downloaded *irma.IrmaIdentifierSet) e ...@@ -1037,5 +1037,5 @@ func (client *Client) ConfigurationUpdated(downloaded *irma.IrmaIdentifierSet) e
} }
} }
return client.storage.StoreAttributes(client.attributes) return client.storage.StoreAllAttributes(client.attributes)
} }
...@@ -175,27 +175,31 @@ func (s *storage) TxStoreSecretKey(tx *bbolt.Tx, sk *secretKey) error { ...@@ -175,27 +175,31 @@ func (s *storage) TxStoreSecretKey(tx *bbolt.Tx, sk *secretKey) error {
return s.txStore(tx, skKey, sk, userdataBucket) return s.txStore(tx, skKey, sk, userdataBucket)
} }
func (s *storage) StoreAttribute(credTypeID irma.CredentialTypeIdentifier, attrlistlist []*irma.AttributeList) error { func (s *storage) StoreAttributes(credTypeID irma.CredentialTypeIdentifier, attrlistlist []*irma.AttributeList) error {
return s.db.Update(func(tx *bbolt.Tx) error { return s.db.Update(func(tx *bbolt.Tx) error {
return s.TxStoreAttribute(tx, credTypeID, attrlistlist) return s.TxStoreAttributes(tx, credTypeID, attrlistlist)
}) })
} }
func (s *storage) TxStoreAttribute(tx *bbolt.Tx, credTypeID irma.CredentialTypeIdentifier, func (s *storage) TxStoreAttributes(tx *bbolt.Tx, credTypeID irma.CredentialTypeIdentifier,
attrlistlist []*irma.AttributeList) error { attrlistlist []*irma.AttributeList) error {
return s.txStore(tx, credTypeID.String(), attrlistlist, attributesBucket) return s.txStore(tx, credTypeID.String(), attrlistlist, attributesBucket)
} }
func (s *storage) StoreAttributes(attributes map[irma.CredentialTypeIdentifier][]*irma.AttributeList) error { func (s *storage) StoreAllAttributes(
attributes map[irma.CredentialTypeIdentifier][]*irma.AttributeList) error {
return s.db.Update(func(tx *bbolt.Tx) error { return s.db.Update(func(tx *bbolt.Tx) error {
return s.TxStoreAttributes(tx, attributes) return s.TxStoreAllAttributes(tx, attributes)
}) })
} }
func (s *storage) TxStoreAttributes(tx *bbolt.Tx, attrs map[irma.CredentialTypeIdentifier][]*irma.AttributeList) error { func (s *storage) TxStoreAllAttributes(tx *bbolt.Tx,
attrs map[irma.CredentialTypeIdentifier][]*irma.AttributeList) error {
for credTypeID, attrlistlist := range attrs { for credTypeID, attrlistlist := range attrs {
err := s.TxStoreAttribute(tx, credTypeID, attrlistlist) err := s.TxStoreAttributes(tx, credTypeID, attrlistlist)
if err != nil { if err != nil {
return err return err
} }
......
...@@ -125,7 +125,7 @@ var clientUpdates = []func(client *Client) error{ ...@@ -125,7 +125,7 @@ var clientUpdates = []func(client *Client) error{
if err != nil { if err != nil {
return err return err
} }
err := client.storage.TxStoreAttributes(tx, attrs) err := client.storage.TxStoreAllAttributes(tx, attrs)
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment