Commit 139f92f5 authored by Sietse Ringers's avatar Sietse Ringers Committed by Sietse Ringers

refactor: rename DoStoreTransaction to Transaction

parent fdbae9b6
......@@ -254,7 +254,7 @@ func (client *Client) addCredential(cred *credential) (err error) {
client.credentialsCache[id][counter] = cred
}
return client.storage.DoStoreTransaction(func(tx *transaction) error {
return client.storage.Transaction(func(tx *transaction) error {
if err = client.storage.TxStoreSignature(tx, cred); err != nil {
return err
}
......@@ -284,7 +284,7 @@ func (client *Client) remove(id irma.CredentialTypeIdentifier, index int, storeL
removed := map[irma.CredentialTypeIdentifier][]irma.TranslatedString{}
removed[id] = attrs.Strings()
err := client.storage.DoStoreTransaction(func(tx *transaction) error {
err := client.storage.Transaction(func(tx *transaction) error {
if err := client.storage.TxDeleteSignature(tx, attrs); err != nil {
return err
}
......@@ -349,7 +349,7 @@ func (client *Client) RemoveAllCredentials() error {
Removed: removed,
}
return client.storage.DoStoreTransaction(func(tx *transaction) error {
return client.storage.Transaction(func(tx *transaction) error {
if err := client.storage.TxDeleteAllAttributes(tx); err != nil {
return err
}
......
......@@ -3,10 +3,11 @@ package irmaclient
import (
"encoding/binary"
"encoding/json"
"github.com/go-errors/errors"
"path/filepath"
"time"
"github.com/go-errors/errors"
"github.com/privacybydesign/gabi"
"github.com/privacybydesign/irmago"
"github.com/privacybydesign/irmago/internal/fs"
......@@ -107,7 +108,7 @@ func (s *storage) load(bucketName string, key string, dest interface{}) (found b
return
}
func (s *storage) DoStoreTransaction(f func(*transaction) error) error {
func (s *storage) Transaction(f func(*transaction) error) error {
return s.db.Update(func(tx *bbolt.Tx) error {
return f(&transaction{tx})
})
......@@ -135,7 +136,7 @@ func (s *storage) TxStoreCLSignature(tx *transaction, credHash string, sig *gabi
}
func (s *storage) StoreSecretKey(sk *secretKey) error {
return s.DoStoreTransaction(func(tx *transaction) error {
return s.Transaction(func(tx *transaction) error {
return s.TxStoreSecretKey(tx, sk)
})
}
......@@ -145,7 +146,7 @@ func (s *storage) TxStoreSecretKey(tx *transaction, sk *secretKey) error {
}
func (s *storage) StoreAttributes(credTypeID irma.CredentialTypeIdentifier, attrlistlist []*irma.AttributeList) error {
return s.DoStoreTransaction(func(tx *transaction) error {
return s.Transaction(func(tx *transaction) error {
return s.TxStoreAttributes(tx, credTypeID, attrlistlist)
})
}
......@@ -165,7 +166,7 @@ func (s *storage) TxDeleteAllAttributes(tx *transaction) error {
}
func (s *storage) StoreKeyshareServers(keyshareServers map[irma.SchemeManagerIdentifier]*keyshareServer) error {
return s.DoStoreTransaction(func(tx *transaction) error {
return s.Transaction(func(tx *transaction) error {
return s.TxStoreKeyshareServers(tx, keyshareServers)
})
}
......@@ -203,7 +204,7 @@ func (s *storage) logEntryKeyToBytes(id uint64) []byte {
}
func (s *storage) StorePreferences(prefs Preferences) error {
return s.DoStoreTransaction(func(tx *transaction) error {
return s.Transaction(func(tx *transaction) error {
return s.TxStorePreferences(tx, prefs)
})
}
......@@ -213,7 +214,7 @@ func (s *storage) TxStorePreferences(tx *transaction, prefs Preferences) error {
}
func (s *storage) StoreUpdates(updates []update) (err error) {
return s.DoStoreTransaction(func(tx *transaction) error {
return s.Transaction(func(tx *transaction) error {
return s.TxStoreUpdates(tx, updates)
})
}
......
......@@ -2,9 +2,10 @@ package irmaclient
import (
"encoding/json"
"github.com/privacybydesign/gabi"
"time"
"github.com/privacybydesign/gabi"
"github.com/privacybydesign/irmago"
)
......@@ -50,7 +51,7 @@ var clientUpdates = []func(client *Client) error{
}
// Open one bolt transaction to process all our log entries in
err = client.storage.DoStoreTransaction(func(tx *transaction) error {
err = client.storage.Transaction(func(tx *transaction) error {
for _, log := range logs {
// As log.Request is a json.RawMessage it would not get updated to the new session request
// format by re-marshaling the containing struct, as normal struct members would,
......@@ -119,7 +120,7 @@ var clientUpdates = []func(client *Client) error{
return err
}
return client.storage.DoStoreTransaction(func(tx *transaction) error {
return client.storage.Transaction(func(tx *transaction) error {
if err = client.storage.TxStoreSecretKey(tx, sk); err != nil {
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