Create implements the Storage abstraction interface.
(nodeCnt int)
| 47 | |
| 48 | // Create implements the Storage abstraction interface. |
| 49 | func (s *SQLite3Storage) Create(nodeCnt int) (dbID string, err error) { |
| 50 | // generate database name |
| 51 | randBytes := make([]byte, 32) |
| 52 | if _, err = rand.Read(randBytes); err != nil { |
| 53 | return |
| 54 | } |
| 55 | dbChecksum := sha256.Sum256(randBytes) |
| 56 | dbID = hex.EncodeToString(dbChecksum[:]) |
| 57 | var dbConn *sql.DB |
| 58 | if dbConn, err = s.getConn(dbID, false); err != nil { |
| 59 | return |
| 60 | } |
| 61 | defer dbConn.Close() |
| 62 | |
| 63 | return |
| 64 | } |
| 65 | |
| 66 | // Drop implements the Storage abstraction interface. |
| 67 | func (s *SQLite3Storage) Drop(dbID string) (err error) { |