Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

han-steve
Copy link

No description provided.

Copy link
Member

@MasterSushiChef MasterSushiChef left a 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?

Comment on lines 191 to +194
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]);
Copy link
Member

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})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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,
Copy link
Member

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)');
Copy link
Member

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]);
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants