-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
completed changing max images to max storage #68
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the getCount() function be deleted and related tests modified?
id = (await db.run('INSERT INTO images DEFAULT VALUES')).lastID; | ||
// Can we simplify this to just one insert statement? | ||
await db.run('UPDATE images SET size = ? WHERE id = ?', | ||
[metadata.size, id]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's possible to simplify into this:
INSERT INTO images(size) VALUES (?);
The rest of the columns will be populated with their default values.
await imageStore.setup(); | ||
|
||
const ids = []; | ||
for (let i = 0; i < 3; i++) { | ||
ids[i] = await imageStore.addImage( | ||
shapes[i], | ||
imagery.Image.create({ time: i }) | ||
imagery.Image.create({ time: i, size: 40}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imagery.Image.create({ time: i, size: 40}) | |
imagery.Image.create({ time: i, size: 40 }) |
* A limit can be placed on the maximum number of images stored by | ||
* setting the maxImages parameter. When the limit is reached, | ||
* A limit can be placed on the maximum size of images stored by | ||
* setting the maxStorage parameter. When the limit is reached, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be absolutely clear on what the unit of maxStorage
is supposed to be. I recommend megabytes.
await this._withDb(async (db) => { | ||
await db.run('CREATE TABLE IF NOT EXISTS ' + | ||
'images(id INTEGER PRIMARY KEY AUTOINCREMENT, ' + | ||
'deleted BOOLEAN DEFAULT FALSE)'); | ||
'deleted BOOLEAN DEFAULT FALSE,' + | ||
'size REAL)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size
might want to be INTEGER
since it's going to be in bytes.
} else { | ||
await db.run('INSERT INTO images(id) VALUES (?)', id); | ||
await db.run('INSERT INTO images(id, size) VALUES (?, ?)', | ||
[id, metadata.size]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The metadata is currently not set up to pass in the size. You'll need to edit the base backend to calculate the size of each photo taken, and update the Protobuf message to include a size field.
No description provided.