Skip to content

Commit

Permalink
Merge pull request #929 from 0xff-dev/file-add-version
Browse files Browse the repository at this point in the history
feat: supports selecting file version
  • Loading branch information
bjwswang authored Mar 27, 2024
2 parents 90515d6 + 6cc1b0b commit 0b9848c
Show file tree
Hide file tree
Showing 26 changed files with 780 additions and 81 deletions.
4 changes: 4 additions & 0 deletions api/base/v1alpha1/datasource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ type OSS struct {
Bucket string `json:"bucket,omitempty"`
// Object must end with a slash "/" if it is a directory
Object string `json:"object,omitempty"`

// VersionID minio enables the file version function,
// so we need to add the VersionID field in OSS to increase the ability to query the specific version of the file.
VersionID string `json:"versionID,omitempty"`
}

// PostgreSQL defines info for PostgreSQL
Expand Down
7 changes: 4 additions & 3 deletions api/base/v1alpha1/knowledgebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ func (f *FileDetails) UpdateErr(err error, phase FileProcessPhase) {

func (f *FileGroupDetail) Init(group FileGroup) {
f.Source = group.Source.DeepCopy()
f.FileDetails = make([]FileDetails, len(group.Paths))
for i := range group.Paths {
f.FileDetails[i].Path = group.Paths[i]
f.FileDetails = make([]FileDetails, len(group.Files))
for i := range group.Files {
f.FileDetails[i].Path = group.Files[i].Path
f.FileDetails[i].Version = group.Files[i].Version
f.FileDetails[i].Phase = FileProcessPhasePending
f.FileDetails[i].LastUpdateTime = metav1.Now()
}
Expand Down
3 changes: 3 additions & 0 deletions api/base/v1alpha1/knowledgebase_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ type FileDetails struct {

// ErrMessage defines the error message
ErrMessage string `json:"errMessage,omitempty"`

// Version file version
Version string `json:"version,omitempty"`
}

type FileProcessPhase string
Expand Down
12 changes: 11 additions & 1 deletion api/base/v1alpha1/versioneddataset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

type FileWithVersion struct {
Path string `json:"path"`
Version string `json:"version,omitempty"`
}

type FileGroup struct {
// From defines the source which provides this `File`
Source *TypedObjectReference `json:"source,omitempty"`

// Paths defines the detail paths to get objects from above datasource
Paths []string `json:"paths,omitempty"`
//
// Deprecated: the paths field will be removed in version 0.3
Paths []string `json:"paths,omitempty"` // nolint

Files []FileWithVersion `json:"files,omitempty"`
}

// VersionedDatasetSpec defines the desired state of VersionedDataset
Expand Down
20 changes: 20 additions & 0 deletions api/base/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b9848c

Please sign in to comment.