File size: 1,472 Bytes
287a0bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package model

import (
	"github.com/chroma/chroma-coordinator/internal/types"
)

type Collection struct {
	ID           types.UniqueID
	Name         string
	Topic        string
	Dimension    *int32
	Metadata     *CollectionMetadata[CollectionMetadataValueType]
	Created      bool
	TenantID     string
	DatabaseName string
	Ts           types.Timestamp
}

type CreateCollection struct {
	ID           types.UniqueID
	Name         string
	Topic        string
	Dimension    *int32
	Metadata     *CollectionMetadata[CollectionMetadataValueType]
	GetOrCreate  bool
	TenantID     string
	DatabaseName string
	Ts           types.Timestamp
}

type DeleteCollection struct {
	ID           types.UniqueID
	TenantID     string
	DatabaseName string
	Ts           types.Timestamp
}

type UpdateCollection struct {
	ID            types.UniqueID
	Name          *string
	Topic         *string
	Dimension     *int32
	Metadata      *CollectionMetadata[CollectionMetadataValueType]
	ResetMetadata bool
	TenantID      string
	DatabaseName  string
	Ts            types.Timestamp
}

func FilterCollection(collection *Collection, collectionID types.UniqueID, collectionName *string, collectionTopic *string) bool {
	if collectionID != types.NilUniqueID() && collectionID != collection.ID {
		return false
	}
	if collectionName != nil && *collectionName != collection.Name {
		return false
	}
	if collectionTopic != nil && *collectionTopic != collection.Topic {
		return false
	}
	return true
}