Sida Chen
ba50d7c626
pgsql: Move lock to lock module
2019-03-12 22:23:30 -04:00
Sida Chen
0b32b36cf7
pgsql: Move detector to pgsql/detector module
2019-03-12 22:23:30 -04:00
Sida Chen
c50a2339b7
pgsql: Split feature.go to table based files in feature module
2019-03-12 22:23:30 -04:00
Sida Chen
43f3ea87d8
pgsql: Move batch queries to corresponding modules
2019-03-12 22:23:30 -04:00
Sida Chen
a33050637b
pgsql: Move extra logic in pgsql.go to util folder
...
- pgsql/util/error.go contains error handling logic
- pgsql/page/page.go contains the page struct
- pgsql/monitoring contains the prometheus logic
- pgsql/pgsession contains the pgsession struct
2019-03-12 22:23:30 -04:00
Sida Chen
8bebea3643
pgsql: Split testutil.go into multiple files
...
- assertion.go assertions used in pgsql tests
- data.go contains go representation of data.sql
- testdb.go contains test db/tx creation logic
- testutil.go contains misc other things
2019-03-12 22:23:30 -04:00
Sida Chen
3fafb73c4f
database: Split models.go into different files each contains one model
2019-03-12 21:55:26 -04:00
Ales Raszka
d77dc0f0ae
Use struct as a map key instead of string
...
String was used when Feature contains PotentialNamespace. Since it was
moved to LayerFeature we can use struct as map key instead of string.
2019-03-08 09:51:40 +01:00
Ales Raszka
a8a91379d9
Add test for potential namespace
...
Test verifies that potential namespace is stored in database and it can
be loaded back to structure.
The commit also fixes few typos and bugs.
2019-03-08 09:51:19 +01:00
Ales Raszka
60b0bd27fa
Add namespace_id as constraints to layer_feature
...
If layer contains more than one potential namespace, features will be
created for each namespace. Layer_feature table now has to contains one
more constrains (namespace_id).
2019-03-07 11:22:54 +01:00
Ales Raszka
60ef726677
Move PotentialNamespace to LayerFeature
...
PotentialNamespace should be in LayerFeature instead of Feature struct.
Feature extractors were updated to return LayerFeature instead of
Feature.
2019-03-07 11:22:54 +01:00
Ales Raszka
44c4a6f3ce
Store PotentialNamespace in database
...
PotentialNamespace is part of layer_feature table and it is also stored
in namespace table.
2019-03-07 11:22:32 +01:00
Ales Raszka
34c2d96b36
featurefmt: Extract PotentialNamespace
...
PotentialNamespace is feature namespace extracted while detecting
features in layer. It will server for special feature detector. The
current detectors return empty namespace.
2019-03-07 11:22:32 +01:00
Sida Chen
b3fe95e152
Merge pull request #724 from KeyboardNerd/ref
...
database: move db logic to dbutil
2019-03-06 15:25:04 -05:00
Sida Chen
1b9ed99646
database: Move db logic to dbutil
...
Move all transaction related logic to dbutil to simplify and later unify
the db interface.
2019-03-06 15:22:21 -05:00
Sida Chen
b03f1bc3a6
pgsql: Fix failed tests
2019-03-06 13:44:23 -05:00
Sida Chen
ed9c6baf4f
pgsql: Fix pgsql test
2019-03-06 11:32:25 -05:00
Sida Chen
046b0e49d1
Add missing licenses
2019-03-05 11:42:59 -05:00
Jimmy Zelinskie
4fa03d1c78
Merge pull request #723 from jzelinskie/lock-tx
...
database: make locks SOI & add Extend method
2019-02-28 15:59:58 -05:00
Jimmy Zelinskie
961c7d4680
database: add test for lock expiration
2019-02-28 15:54:57 -05:00
Jimmy Zelinskie
a4e7873d14
database: make locks SOI & add Extend method
2019-02-28 15:46:31 -05:00
Sida Chen
f7e54c1a28
Merge pull request #695 from saromanov/fix-unchecked-error
...
pgsql: fix unchecked error
2019-02-27 13:05:52 -05:00
Sida Chen
5bf8365f7b
pgsql: Prevent inserting invalid entry to database
2019-02-26 10:26:49 -05:00
Sida Chen
8aae73f1c8
pgsql: Remove unnecessary logs
2019-02-26 10:26:49 -05:00
Sida Chen
5b2376498b
clair: Use builder pattern for constructing ancestry
...
- Add Ancestry builder
- Change RPC to use the ancestry builder
2019-02-26 10:26:49 -05:00
Sida Chen
73bc2bc36b
Merge pull request #672 from KeyboardNerd/source_package/feature_type
...
Implement Feature types
2019-02-20 15:58:50 -05:00
Sida Chen
5a94499fdb
update according to comments
2019-02-19 17:57:38 -05:00
Sida Chen
79af05e67d
pgsql: Fix postgres queries for feature_type
2019-02-19 16:48:42 -05:00
Sida Chen
5fa1ac89b9
database: Add StorageError type
2019-02-19 16:48:42 -05:00
Sida Chen
073c685c5b
pgsql: Add proper tests for database migration
2019-02-19 16:48:42 -05:00
Sida Chen
f61675355e
database: Update feature model
...
Remove source name/version fields
Add Type field to indicate if it's binary package or source package
2019-02-19 16:48:42 -05:00
Sida Chen
7dd989c0f2
database: Rename affected Type to feature type
2019-02-19 16:48:42 -05:00
Sida Chen
00eed77b45
database: Add feature_type database model
2019-02-19 16:48:42 -05:00
Sida Chen
c6c8fce39a
pgsql: Add feature_type to initial schema
...
feature_type is for differentiating the binary packages and source
packages.
2019-02-19 16:43:35 -05:00
Jimmy Zelinskie
cafe0976a4
Merge pull request #685 from jzelinskie/updater-cleanup
...
updater: remove FindLock(), use errgroup to avoid races
2019-02-14 14:57:59 -05:00
Jimmy Zelinskie
dd91597f19
database: remove FindLock from mock
2019-02-14 14:27:29 -05:00
Sergey
a57d806717
pgsql: fix unchecked error
2019-01-21 17:57:52 +05:00
Ales Raszka
015a79fd5a
Layer: replace arrays with slices
...
The current code is much cleaner because it doesn't use indexes + it
should be more memory efficient.
2019-01-16 09:12:34 +01:00
Ales Raszka
90f5592095
Feature: replace arrays with slices
...
The current code is much cleaner because it doesn't use indexes + it
should be more memory efficient.
2019-01-16 09:12:33 +01:00
Jimmy Zelinskie
399deab100
database: remove FindLock()
2019-01-10 13:50:46 -05:00
Jimmy Zelinskie
300bb52696
database: add FindLock dbutil
2018-11-28 13:37:15 -05:00
Jimmy Zelinskie
4fbeb9ced5
database: add (Acquire|Release)Lock dbutils
2018-11-27 13:59:07 -05:00
Kate Murphy
6c682da3e1
database: add mapping for Ubuntu Cosmic (18.10)
2018-10-29 13:42:44 -04:00
Sida Chen
a3f7387ff1
database: Add FindKeyValue function wrapper
2018-10-22 23:00:57 -04:00
Sida Chen
00fadfc3e3
database: Add affected feature type
...
Affected feature type is for determining either the source feature or
the binary feature that an vulnerability affects.
2018-10-18 15:06:41 -04:00
Sida Chen
f759dd54c0
database: Replace Parent Feature with source metadata
...
Feature's source feature string is directly stored in the database
instead of having the parent pointer to simplify the database.
2018-10-15 16:26:24 -04:00
Sida Chen
3fe894c5ad
database: Add parent feature pointer to Feature struct
...
Feature now has a pointer to parent feature. If a vulnerability affects
a parent feature, this child feature will be affected.
2018-10-09 19:52:10 -04:00
Sida Chen
a3e9b5b55d
database: rename utility functions with commit/rollback
...
All database utility functions are renamed to explicitly say if it will
commit changes or rollback changes on success.
2018-10-08 13:12:18 -04:00
Sida Chen
e657d26313
database: move dbutil and testutil to database from pkg
...
Move dbutil and testutil to database from pkg
Rename all "result"
2018-10-08 12:10:35 -04:00
Sida Chen
0c1b80b2ed
pgsql: Implement database queries for detector relationship
...
* Refactor layer and ancestry
* Add tests
* Fix bugs introduced when the queries were moved
2018-10-08 11:27:15 -04:00