Documentation
¶
Index ¶
- Constants
- Variables
- type Authorization
- type AuthorizationRepository
- func (a *AuthorizationRepository) Add(ctx context.Context, authorization *Authorization) error
- func (a *AuthorizationRepository) Get(ctx context.Context, username string) (*Authorization, error)
- func (a *AuthorizationRepository) InitSchema(ctx context.Context) error
- func (a *AuthorizationRepository) List(ctx context.Context, regexp string) ([]Authorization, error)
- func (a *AuthorizationRepository) Set(ctx context.Context, authorization *Authorization) error
- type Comment
- type CommentWithAddtional
- type CommentsRepository
- func (c *CommentsRepository) Count(ctx context.Context, listoptions ListCommentOptions) (int64, error)
- func (c *CommentsRepository) Create(ctx context.Context, postID string, comment *Comment) error
- func (c *CommentsRepository) Delete(ctx context.Context, comment *Comment) error
- func (c *CommentsRepository) InitSchema(ctx context.Context) error
- func (c *CommentsRepository) List(ctx context.Context, listoptions ListCommentOptions) ([]CommentWithAddtional, error)
- func (c *CommentsRepository) Rating(ctx context.Context, ids ...string) ([]Rating, error)
- func (c *CommentsRepository) Update(ctx context.Context, comment *Comment) error
- type CommonListOptions
- type GetSourceOptions
- type ListCommentOptions
- type ListSourceOptions
- type Model
- type ModelFile
- type ModelListOptions
- type ModelVersion
- type ModelWithAddtional
- type ModelsRepository
- func (m *ModelsRepository) Count(ctx context.Context, opts ModelListOptions) (int64, error)
- func (m *ModelsRepository) Create(ctx context.Context, model Model) error
- func (m *ModelsRepository) CreateOrUpdateFromSync(ctx context.Context, model *Model) error
- func (m *ModelsRepository) Delete(ctx context.Context, source, name string) error
- func (m *ModelsRepository) Get(ctx context.Context, source, name string, includedisabled bool) (ModelWithAddtional, error)
- func (r *ModelsRepository) GetVersion(ctx context.Context, source, model, version string) (ModelVersion, error)
- func (m *ModelsRepository) InitSchema(ctx context.Context) error
- func (m *ModelsRepository) List(ctx context.Context, opts ModelListOptions) ([]ModelWithAddtional, error)
- func (m *ModelsRepository) ListSelectors(ctx context.Context, listopts ModelListOptions) (*Selectors, error)
- func (r *ModelsRepository) ListVersions(ctx context.Context, source, model string) ([]ModelVersion, error)
- func (m *ModelsRepository) Update(ctx context.Context, model *Model) error
- func (r *ModelsRepository) Upsert(ctx context.Context, model Model) (Model, error)
- type Rating
- type ReplyTo
- type Selectors
- type Source
- type SourceAuth
- type SourceWithAddtional
- type SourcesRepository
- func (r *SourcesRepository) Count(ctx context.Context, opts ListSourceOptions) (int64, error)
- func (s *SourcesRepository) Create(ctx context.Context, source *Source) error
- func (r SourcesRepository) Delete(ctx context.Context, source *Source) error
- func (r *SourcesRepository) Get(ctx context.Context, name string, opts GetSourceOptions) (*SourceWithAddtional, error)
- func (r *SourcesRepository) InitSchema(ctx context.Context) error
- func (r *SourcesRepository) List(ctx context.Context, opts ListSourceOptions) ([]SourceWithAddtional, error)
- func (s *SourcesRepository) Update(ctx context.Context, source *Source) error
Constants ¶
View Source
const ( SourceKindHuggingface = "huggingface" SourceKindOpenMMLab = "openmmlab" SourceKindModelx = "modelx" )
View Source
const AnnotationRequieToken = "modelx.kubegems.io/token-required"
Variables ¶
View Source
var InitSources = []any{ Source{ Name: SourceKindHuggingface, BuiltIn: true, Online: true, Enabled: true, Kind: SourceKindHuggingface, Images: []string{}, }, Source{ Name: SourceKindOpenMMLab, BuiltIn: true, Online: true, Enabled: true, Kind: SourceKindOpenMMLab, Images: []string{ "kubegems/mlserver-mmlab", }, }, }
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
type AuthorizationRepository ¶
type AuthorizationRepository struct {
// contains filtered or unexported fields
}
func NewAuthorizationRepository ¶
func NewAuthorizationRepository(ctx context.Context, db *mongo.Database) *AuthorizationRepository
func (*AuthorizationRepository) Add ¶
func (a *AuthorizationRepository) Add(ctx context.Context, authorization *Authorization) error
func (*AuthorizationRepository) Get ¶
func (a *AuthorizationRepository) Get(ctx context.Context, username string) (*Authorization, error)
func (*AuthorizationRepository) InitSchema ¶
func (a *AuthorizationRepository) InitSchema(ctx context.Context) error
func (*AuthorizationRepository) List ¶
func (a *AuthorizationRepository) List(ctx context.Context, regexp string) ([]Authorization, error)
func (*AuthorizationRepository) Set ¶
func (a *AuthorizationRepository) Set(ctx context.Context, authorization *Authorization) error
type Comment ¶
type Comment struct { // nolint: tagliatelle ID string `json:"id,omitempty" bson:"_id,omitempty"` // id Username string `json:"username"` // user's id (username) PostID string `json:"postID"` // post id Content string `json:"content"` // comment's content ReplyTo *ReplyTo `json:"replyTo" ` // comment's content(some section) reply to Rating int `json:"rating"` // rating value (1-5) CreationTime time.Time `json:"creationTime"` // comment's create time UpdationTime time.Time `json:"updationTime"` // comment's update time }
type CommentWithAddtional ¶
type CommentWithAddtional struct { Comment `json:",inline" bson:",inline"` RepliesCount int64 `json:"repliesCount,omitempty"` Replies []CommentWithAddtional `json:"replies,omitempty"` }
type CommentsRepository ¶
type CommentsRepository struct {
Collection *mongo.Collection
}
func NewCommentsRepository ¶
func NewCommentsRepository(db *mongo.Database) *CommentsRepository
func (*CommentsRepository) Count ¶
func (c *CommentsRepository) Count(ctx context.Context, listoptions ListCommentOptions) (int64, error)
func (*CommentsRepository) Delete ¶
func (c *CommentsRepository) Delete(ctx context.Context, comment *Comment) error
func (*CommentsRepository) InitSchema ¶
func (c *CommentsRepository) InitSchema(ctx context.Context) error
func (*CommentsRepository) List ¶
func (c *CommentsRepository) List(ctx context.Context, listoptions ListCommentOptions) ([]CommentWithAddtional, error)
type CommonListOptions ¶
type GetSourceOptions ¶
type ListCommentOptions ¶
type ListCommentOptions struct { CommonListOptions PostID string // find comments of this post ReplyToID string // find all replies of this comment WithReplies bool // include replies in the result }
func (ListCommentOptions) ToConditionAndFindOptions ¶
func (o ListCommentOptions) ToConditionAndFindOptions() (interface{}, *options.FindOptions)
type ListSourceOptions ¶
func (ListSourceOptions) ToConditionAndFindOptions ¶
func (o ListSourceOptions) ToConditionAndFindOptions() (interface{}, *options.FindOptions)
type Model ¶
type Model struct { ID string `json:"id,omitempty" bson:"_id,omitempty"` Source string `json:"source"` // source of model (huggingface, ...) Name string `json:"name"` Tags []string `json:"tags"` Author string `json:"author"` License string `json:"license"` Framework string `json:"framework"` Paper map[string]string `json:"paper"` Downloads int `json:"downloads"` Task string `json:"task"` Likes int `json:"likes"` Versions []ModelVersion `json:"versions"` // versions of model Recomment int `json:"recomment"` // number of recomment votes RecommentContent string `json:"recommentContent"` // content of recomment CreateAt *time.Time `json:"createAt" bson:"create_at"` // original creation time UpdateAt *time.Time `json:"updateAt" bson:"update_at"` // original updattion time LastModified *time.Time `json:"lastModified" bson:"lastModified"` // last time the model synced Enabled bool `json:"enabled"` // is model published Annotations map[string]string `json:"annotations"` // additional infomations }
model meta in models store nolint: tagliatelle
type ModelListOptions ¶
type ModelListOptions struct { CommonListOptions Source string Tags []string License string Framework string Task string WithRating bool WithDisabled bool WithVersions bool }
func (*ModelListOptions) ToConditionAndFindOptions ¶
func (o *ModelListOptions) ToConditionAndFindOptions() (interface{}, *options.FindOptions)
type ModelVersion ¶
type ModelWithAddtional ¶
type ModelsRepository ¶
type ModelsRepository struct {
Collection *mongo.Collection
}
func NewModelsRepository ¶
func NewModelsRepository(db *mongo.Database) *ModelsRepository
func (*ModelsRepository) Count ¶
func (m *ModelsRepository) Count(ctx context.Context, opts ModelListOptions) (int64, error)
func (*ModelsRepository) Create ¶
func (m *ModelsRepository) Create(ctx context.Context, model Model) error
func (*ModelsRepository) CreateOrUpdateFromSync ¶
func (m *ModelsRepository) CreateOrUpdateFromSync(ctx context.Context, model *Model) error
func (*ModelsRepository) Delete ¶
func (m *ModelsRepository) Delete(ctx context.Context, source, name string) error
func (*ModelsRepository) Get ¶
func (m *ModelsRepository) Get(ctx context.Context, source, name string, includedisabled bool) (ModelWithAddtional, error)
func (*ModelsRepository) GetVersion ¶
func (r *ModelsRepository) GetVersion(ctx context.Context, source, model, version string) (ModelVersion, error)
func (*ModelsRepository) InitSchema ¶
func (m *ModelsRepository) InitSchema(ctx context.Context) error
func (*ModelsRepository) List ¶
func (m *ModelsRepository) List(ctx context.Context, opts ModelListOptions) ([]ModelWithAddtional, error)
nolint: funlen
func (*ModelsRepository) ListSelectors ¶
func (m *ModelsRepository) ListSelectors(ctx context.Context, listopts ModelListOptions) (*Selectors, error)
func (*ModelsRepository) ListVersions ¶
func (r *ModelsRepository) ListVersions(ctx context.Context, source, model string) ([]ModelVersion, error)
type Rating ¶
type Rating struct { ID string `json:"id,omitempty" bson:"_id,omitempty"` Rating float64 `json:"rating"` Count int64 `json:"count"` Total int64 `json:"total"` }
nolint: tagliatelle
type ReplyTo ¶
type ReplyTo struct { // nolint: tagliatelle ID string `json:"id,omitempty" bson:"_id,omitempty"` // id of the comment that this comment reply to RootID string `json:"rootID"` // id of the top level comment, if this comment is a reply to a reply Content string `json:"content"` // comment's content Username string `json:"username"` // user's id (username) CreationTime time.Time `json:"creationTime"` // comment's create time }
type Source ¶
type Source struct { // nolint: tagliatelle ID string `json:"id,omitempty" bson:"_id,omitempty"` Name string `json:"name"` BuiltIn bool `json:"builtIn"` Online bool `json:"online"` Images []string `json:"images"` CreationTime time.Time `json:"creationTime"` UpdationTime time.Time `json:"updationTime"` Enabled bool `json:"enabled"` InitImage string `json:"initImage"` // storage initialize image Kind string `json:"kind"` // kind of source (huggingface, openmmlab, modelx...) Address string `json:"address"` // address of source Auth SourceAuth `json:"auth"` // auth of source Annotations map[string]string `json:"annotations"` }
type SourceAuth ¶
type SourceWithAddtional ¶
type SourcesRepository ¶
type SourcesRepository struct {
Collection *mongo.Collection
}
func NewSourcesRepository ¶
func NewSourcesRepository(db *mongo.Database) *SourcesRepository
func (*SourcesRepository) Count ¶
func (r *SourcesRepository) Count(ctx context.Context, opts ListSourceOptions) (int64, error)
func (*SourcesRepository) Create ¶
func (s *SourcesRepository) Create(ctx context.Context, source *Source) error
func (SourcesRepository) Delete ¶
func (r SourcesRepository) Delete(ctx context.Context, source *Source) error
func (*SourcesRepository) Get ¶
func (r *SourcesRepository) Get(ctx context.Context, name string, opts GetSourceOptions) (*SourceWithAddtional, error)
func (*SourcesRepository) InitSchema ¶
func (r *SourcesRepository) InitSchema(ctx context.Context) error
func (*SourcesRepository) List ¶
func (r *SourcesRepository) List(ctx context.Context, opts ListSourceOptions) ([]SourceWithAddtional, error)
Click to show internal directories.
Click to hide internal directories.