storage

package
v0.0.0-...-46685fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MongodbStorageTypeProvider

func MongodbStorageTypeProvider(storageType string, storageConfig *grafeasConfig.StorageConfiguration) (*storage.Storage, error)

Types

type MongoDb

type MongoDb struct {
	*mongo.Database
	PaginationKey string
}

func NewMongoDbStore

func NewMongoDbStore(config *config.MongoDbConfig) *MongoDb

func (*MongoDb) BatchCreateNotes

func (pg *MongoDb) BatchCreateNotes(ctx context.Context, pID, uID string, notes map[string]*pb.Note) ([]*pb.Note, []error)

BatchCreateNotes batch creates the specified notes in memstore.

func (*MongoDb) BatchCreateOccurrences

func (pg *MongoDb) BatchCreateOccurrences(ctx context.Context, pID string, uID string, occs []*pb.Occurrence) ([]*pb.Occurrence, []error)

BatchCreateOccurrence batch creates the specified occurrences in PostreSQL.

func (*MongoDb) CreateNote

func (pg *MongoDb) CreateNote(ctx context.Context, pID, nID, uID string, n *pb.Note) (*pb.Note, error)

CreateNote adds the specified note

func (*MongoDb) CreateOccurrence

func (pg *MongoDb) CreateOccurrence(ctx context.Context, pID, uID string, o *pb.Occurrence) (*pb.Occurrence, error)

CreateOccurrence adds the specified occurrence

func (*MongoDb) CreateProject

func (pg *MongoDb) CreateProject(ctx context.Context, pID string, p *prpb.Project) (*prpb.Project, error)

CreateProject adds the specified project to the store

func (*MongoDb) DeleteNote

func (pg *MongoDb) DeleteNote(ctx context.Context, pID, nID string) error

DeleteNote deletes the note with the given pID and nID

func (*MongoDb) DeleteOccurrence

func (pg *MongoDb) DeleteOccurrence(ctx context.Context, pID, oID string) error

DeleteOccurrence deletes the occurrence with the given pID and oID

func (*MongoDb) DeleteProject

func (pg *MongoDb) DeleteProject(ctx context.Context, pID string) error

DeleteProject deletes the project with the given pID from the store

func (*MongoDb) GetNote

func (pg *MongoDb) GetNote(ctx context.Context, pID, nID string) (*pb.Note, error)

GetNote returns the note with project (pID) and note ID (nID)

func (*MongoDb) GetOccurrence

func (pg *MongoDb) GetOccurrence(ctx context.Context, pID, oID string) (*pb.Occurrence, error)

GetOccurrence returns the occurrence with pID and oID

func (*MongoDb) GetOccurrenceNote

func (pg *MongoDb) GetOccurrenceNote(ctx context.Context, pID, oID string) (*pb.Note, error)

GetOccurrenceNote gets the note for the specified occurrence from PostgreSQL.

func (*MongoDb) GetProject

func (pg *MongoDb) GetProject(ctx context.Context, pID string) (*prpb.Project, error)

GetProject returns the project with the given pID from the store

func (*MongoDb) GetVulnerabilityOccurrencesSummary

func (pg *MongoDb) GetVulnerabilityOccurrencesSummary(ctx context.Context, projectID, filter string) (*pb.VulnerabilityOccurrencesSummary, error)

GetVulnerabilityOccurrencesSummary gets a summary of vulnerability occurrences from storage.

func (*MongoDb) ListNoteOccurrences

func (pg *MongoDb) ListNoteOccurrences(ctx context.Context, pID, nID, filter, pageToken string, pageSize int32) ([]*pb.Occurrence, string, error)

ListNoteOccurrences returns up to pageSize number of occcurrences on the particular note (nID) for this project (pID) projects beginning at pageToken (or from start if pageToken is the empty string).

func (*MongoDb) ListNotes

func (pg *MongoDb) ListNotes(ctx context.Context, pID, filter, pageToken string, pageSize int32) ([]*pb.Note, string, error)

ListNotes returns up to pageSize number of notes for this project (pID) beginning at pageToken (or from start if pageToken is the empty string).

func (*MongoDb) ListOccurrences

func (pg *MongoDb) ListOccurrences(ctx context.Context, pID, filter, pageToken string, pageSize int32) ([]*pb.Occurrence, string, error)

ListOccurrences returns up to pageSize number of occurrences for this project beginning at pageToken, or from start if pageToken is the empty string.

func (*MongoDb) ListProjects

func (pg *MongoDb) ListProjects(ctx context.Context, filter string, pageSize int, pageToken string) ([]*prpb.Project, string, error)

ListProjects returns up to pageSize number of projects beginning at pageToken (or from start if pageToken is the empty string).

func (*MongoDb) UpdateNote

func (pg *MongoDb) UpdateNote(ctx context.Context, pID, nID string, n *pb.Note, mask *fieldmaskpb.FieldMask) (*pb.Note, error)

UpdateNote updates the existing note with the given pID and nID

func (*MongoDb) UpdateOccurrence

func (pg *MongoDb) UpdateOccurrence(ctx context.Context, pID, oID string, o *pb.Occurrence, mask *fieldmaskpb.FieldMask) (*pb.Occurrence, error)

UpdateOccurrence updates the existing occurrence with the given projectID and occurrenceID

type Occurrence

type Occurrence struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL