Documentation
¶
Index ¶
- Constants
- func AddAccountRangeToTag(id string, startRangeStr string, endRangeStr string) error
- func AddMembersToTag(id string, members []string) (int, error)
- func AddMembersToTagV2Handler(w http.ResponseWriter, r *http.Request)
- func AddMembersToXconfTag(id string, members []string) *taggingds.Tag
- func AddMembersV2(tagId string, members []string) error
- func AddMembersWithXdas(tagId string, members []string) error
- func CheckBatchSizeExceeded(batchSize int) error
- func CleanPercentageRange(id string) error
- func DeleteOneTag(id string) error
- func DeleteTag(id string) error
- func DeleteTagV2(tagId string) error
- func DeleteTagV2Handler(w http.ResponseWriter, r *http.Request)
- func GetAllTagIds() ([]string, error)
- func GetAllTagIdsV2() ([]string, error)
- func GetAllTags() ([]*taggingds.Tag, error)
- func GetAllTagsV2Handler(w http.ResponseWriter, r *http.Request)
- func GetGroupServiceConnector() *http.GroupServiceConnector
- func GetGroupServiceSyncConnector() *http.GroupServiceSyncConnector
- func GetMembersV2NonPaginated(tagId string) ([]string, bool, error)
- func GetOneTag(id string) *taggingds.Tag
- func GetTagApiConfig() *taggingapi_config.TaggingApiConfig
- func GetTagById(id string) *taggingds.Tag
- func GetTagByIdV2(tagId string) ([]string, bool, error)
- func GetTagByIdV2Handler(w http.ResponseWriter, r *http.Request)
- func GetTagMembers(id string) ([]string, error)
- func GetTagMembersV2Handler(w http.ResponseWriter, r *http.Request)
- func GetTagsByMember(member string) ([]string, error)
- func GetTagsByMemberHandler(w http.ResponseWriter, r *http.Request)
- func GetTagsByMemberPercentage(member string) ([]string, error)
- func MigrateV1ToV2Handler(w http.ResponseWriter, r *http.Request)
- func MigrationStatusHandler(w http.ResponseWriter, r *http.Request)
- func RemoveMemberFromTag(id string, member string) (*taggingds.Tag, error)
- func RemoveMemberFromTagV2Handler(w http.ResponseWriter, r *http.Request)
- func RemoveMemberV2WithXdas(tagId string, member string) error
- func RemoveMembersFromTag(id string, members []string) (int, error)
- func RemoveMembersFromTagV2Handler(w http.ResponseWriter, r *http.Request)
- func RemoveMembersV2(tagId string, members []string) error
- func RemoveMembersV2WithXdas(tagId string, members []string) error
- func RemovePrefixFromTag(tagId string) string
- func SaveTag(tag *taggingds.Tag) error
- func SetTagApiConfig(config *taggingapi_config.TaggingApiConfig)
- func SetTagPrefix(tagId string) string
- func ToEstbIfMac(member string) string
- func ToNormalized(member string) string
- func ToNormalizedEcm(member string) string
- type BucketedCursor
- type DryRunResponse
- type DryRunSummary
- type MigrationJobManager
- func (m *MigrationJobManager) CancelJob() error
- func (m *MigrationJobManager) CancelJobComplete(result *MigrationResponse)
- func (m *MigrationJobManager) CompleteJob(result *MigrationResponse)
- func (m *MigrationJobManager) FailJob(err error)
- func (m *MigrationJobManager) GetContext() context.Context
- func (m *MigrationJobManager) GetStatus() MigrationJobStatus
- func (m *MigrationJobManager) StartJob(command string) error
- func (m *MigrationJobManager) UpdateProgress(updateFunc func(*MigrationProgress))
- type MigrationJobState
- type MigrationJobStatus
- type MigrationProgress
- type MigrationResponse
- type MigrationSummary
- type PaginatedMembersResponse
- type PaginationParams
- type TagMemberStats
- type TagMigrationSkip
Constants ¶
const ( RequestBodyReadErrorMsg = "request body unmarshall error: %s" NotSpecifiedErrorMsg = "%s is not specified" EmptyListErrorMsg = "%s list is empty" MaxMemberLimitExceededErrorMsg = "batch size %d exceeds the limit of %d" ResponseWriterCastErrorMsg = "response writer cast error" NotFoundErrorMsg = "%s tag not found" TagMemberLimit = 1000 )
const ( DefaultPageSize = 1000 MaxPageSize = 5000 )
const ( LoggedBatch = 0 UnloggedBatch = 1 CounterBatch = 2 )
const ( TableTagMembersBucketed = "TagMembersBucketed" BucketCount = 1000 DefaultPageSizeV2 = 500 MaxPageSizeV2 = 5000 MaxBatchSizeV2 = 5000 MaxWorkersV2 = 100 MaxMembersInTagResponse = 100000 // Max members returned in GetTagById MemberFetchChunkSize = 1000 // Chunk size for memory-safe pagination QueryAddMemberBucketed = `INSERT INTO "TagMembersBucketed" (tag_id, bucket_id, member, created) VALUES (?, ?, ?, ?)` QueryRemoveMemberBucketed = `DELETE FROM "TagMembersBucketed" WHERE tag_id = ? AND bucket_id = ? AND member = ?` QueryGetMembersByBucket = `SELECT member FROM "TagMembersBucketed" WHERE tag_id = ? AND bucket_id = ? AND member > ? LIMIT ?` QueryGetMembersByBucketFirst = `SELECT member FROM "TagMembersBucketed" WHERE tag_id = ? AND bucket_id = ? LIMIT ?` QueryGetPopulatedBuckets = `SELECT bucket_id FROM "TagBucketMetadata" WHERE tag_id = ?` QueryAddBucketMetadata = `INSERT INTO "TagBucketMetadata" (tag_id, bucket_id) VALUES (?, ?)` QueryRemoveBucketMetadata = `DELETE FROM "TagBucketMetadata" WHERE tag_id = ? AND bucket_id = ?` QueryGetAllTagIds = `SELECT tag_id FROM "TagBucketMetadata"` QueryDeleteBucketMembers = `DELETE FROM "TagMembersBucketed" WHERE tag_id = ? AND bucket_id = ?` QueryDeleteBucketMetadata = `DELETE FROM "TagBucketMetadata" WHERE tag_id = ? AND bucket_id = ?` )
const ( CommandDryRun = "dryRun" CommandStart = "start" CommandCancel = "cancel" )
Migration command constants
const ( ReasonTagNotFound = "tag_not_found_in_v1" ReasonNoMembers = "no_members" ReasonTypeConversion = "type_conversion_error" ReasonXdasVerification = "xdas_verification_failed" ReasonDatabaseWriteFailed = "database_write_failed" )
Skip reason constants
const ( Prefix = "t_" Template = "%s%s" )
const ( StringToIntConversionErr = "error converting string %s value to int: %s" IncorrectRangeErr = "start range should be greater then end range" MinStartPercentage = 0 MaxEndPercentage = 100 )
const (
CloneErrorMsg = "error cloning %s tag"
)
Variables ¶
This section is empty.
Functions ¶
func AddAccountRangeToTag ¶
func AddMembersToTagV2Handler ¶ added in v1.0.10
func AddMembersToTagV2Handler(w http.ResponseWriter, r *http.Request)
AddMembersToTagV2Handler - Updated with bucketed implementation
func AddMembersV2 ¶ added in v1.0.10
func AddMembersWithXdas ¶ added in v1.0.10
AddMembersWithXdas adds members to both XDAS and Cassandra (XDAS-first approach)
func CheckBatchSizeExceeded ¶
func CleanPercentageRange ¶
func DeleteOneTag ¶
func DeleteTagV2 ¶ added in v1.0.10
DeleteTagV2 deletes a tag completely from V2 storage (XDAS and Cassandra) Uses memory-safe chunked deletion to handle tags with millions of members
func DeleteTagV2Handler ¶ added in v1.0.10
func DeleteTagV2Handler(w http.ResponseWriter, r *http.Request)
DeleteTagV2Handler deletes a tag and all its members from V2 storage asynchronously
func GetAllTagIds ¶
func GetAllTagIdsV2 ¶ added in v1.0.10
GetAllTagIdsV2 returns all tag IDs from V2 tables
func GetAllTags ¶
func GetAllTagsV2Handler ¶ added in v1.0.10
func GetAllTagsV2Handler(w http.ResponseWriter, r *http.Request)
GetAllTagsV2Handler returns all tag IDs from V2 storage
func GetGroupServiceConnector ¶
func GetGroupServiceConnector() *http.GroupServiceConnector
func GetGroupServiceSyncConnector ¶
func GetGroupServiceSyncConnector() *http.GroupServiceSyncConnector
func GetMembersV2NonPaginated ¶ added in v1.0.10
GetMembersV2NonPaginated retrieves tag members for non-paginated response (V1 compatibility) Returns up to MaxMembersInTagResponse (100k) members as a plain array
func GetTagApiConfig ¶
func GetTagApiConfig() *taggingapi_config.TaggingApiConfig
func GetTagById ¶
func GetTagByIdV2 ¶ added in v1.0.10
GetTagByIdV2 retrieves a tag with up to MaxMembersInTagResponse members
func GetTagByIdV2Handler ¶ added in v1.0.10
func GetTagByIdV2Handler(w http.ResponseWriter, r *http.Request)
GetTagByIdV2Handler retrieves a single tag with its members from V2 storage
func GetTagMembers ¶
func GetTagMembersV2Handler ¶ added in v1.0.10
func GetTagMembersV2Handler(w http.ResponseWriter, r *http.Request)
GetTagMembersV2Handler - Unified handler supporting both paginated and non-paginated responses Non-paginated mode (V1 compatible): Returns []string with up to 100k members, HTTP 206 if truncated Paginated mode: Returns paginated envelope when limit/cursor params are present
func GetTagsByMember ¶
func GetTagsByMemberHandler ¶
func GetTagsByMemberHandler(w http.ResponseWriter, r *http.Request)
func MigrateV1ToV2Handler ¶ added in v1.0.10
func MigrateV1ToV2Handler(w http.ResponseWriter, r *http.Request)
MigrateV1ToV2Handler handles the migration from V1 to V2 tag storage
func MigrationStatusHandler ¶ added in v1.0.10
func MigrationStatusHandler(w http.ResponseWriter, r *http.Request)
MigrationStatusHandler returns the current migration job status
func RemoveMemberFromTag ¶
func RemoveMemberFromTagV2Handler ¶ added in v1.0.10
func RemoveMemberFromTagV2Handler(w http.ResponseWriter, r *http.Request)
RemoveMemberFromTagV2Handler - Updated with bucketed implementation
func RemoveMemberV2WithXdas ¶ added in v1.0.10
RemoveMemberV2WithXdas removes a single member from both XDAS and Cassandra V2
func RemoveMembersFromTagV2Handler ¶ added in v1.0.10
func RemoveMembersFromTagV2Handler(w http.ResponseWriter, r *http.Request)
RemoveMembersFromTagV2Handler - Updated with bucketed implementation
func RemoveMembersV2 ¶ added in v1.0.10
func RemoveMembersV2WithXdas ¶ added in v1.0.10
RemoveMembersV2WithXdas removes members from both XDAS and Cassandra (XDAS-first approach)
func RemovePrefixFromTag ¶
func SetTagApiConfig ¶
func SetTagApiConfig(config *taggingapi_config.TaggingApiConfig)
func SetTagPrefix ¶
func ToEstbIfMac ¶
func ToNormalized ¶
func ToNormalizedEcm ¶
Types ¶
type BucketedCursor ¶ added in v1.0.10
type DryRunResponse ¶ added in v1.0.10
type DryRunResponse struct {
Summary DryRunSummary `json:"summary"`
Tags map[string]int `json:"tags"`
Warnings []string `json:"warnings,omitempty"`
}
DryRunResponse represents the response for a dry run migration
type DryRunSummary ¶ added in v1.0.10
type DryRunSummary struct {
TotalTags int `json:"totalTags"`
TotalMembersInXconf int `json:"totalMembersInXconf"`
}
DryRunSummary provides overall statistics for dry run
type MigrationJobManager ¶ added in v1.0.10
type MigrationJobManager struct {
// contains filtered or unexported fields
}
MigrationJobManager manages the migration job lifecycle
func (*MigrationJobManager) CancelJob ¶ added in v1.0.10
func (m *MigrationJobManager) CancelJob() error
CancelJob cancels the running migration job
func (*MigrationJobManager) CancelJobComplete ¶ added in v1.0.10
func (m *MigrationJobManager) CancelJobComplete(result *MigrationResponse)
CancelJobComplete marks the job as cancelled with partial results
func (*MigrationJobManager) CompleteJob ¶ added in v1.0.10
func (m *MigrationJobManager) CompleteJob(result *MigrationResponse)
CompleteJob marks the job as completed with results
func (*MigrationJobManager) FailJob ¶ added in v1.0.10
func (m *MigrationJobManager) FailJob(err error)
FailJob marks the job as failed
func (*MigrationJobManager) GetContext ¶ added in v1.0.10
func (m *MigrationJobManager) GetContext() context.Context
GetContext returns the current job context
func (*MigrationJobManager) GetStatus ¶ added in v1.0.10
func (m *MigrationJobManager) GetStatus() MigrationJobStatus
GetStatus returns the current job status (thread-safe)
func (*MigrationJobManager) StartJob ¶ added in v1.0.10
func (m *MigrationJobManager) StartJob(command string) error
StartJob initiates a new migration job
func (*MigrationJobManager) UpdateProgress ¶ added in v1.0.10
func (m *MigrationJobManager) UpdateProgress(updateFunc func(*MigrationProgress))
UpdateProgress updates the migration progress (thread-safe)
type MigrationJobState ¶ added in v1.0.10
type MigrationJobState string
Migration job state constants
const ( StateIdle MigrationJobState = "idle" StateRunning MigrationJobState = "running" StateCompleted MigrationJobState = "completed" StateFailed MigrationJobState = "failed" StateCancelled MigrationJobState = "cancelled" )
type MigrationJobStatus ¶ added in v1.0.10
type MigrationJobStatus struct {
State MigrationJobState `json:"state"`
Command string `json:"command,omitempty"`
StartTime *time.Time `json:"startTime,omitempty"`
EndTime *time.Time `json:"endTime,omitempty"`
DurationSeconds float64 `json:"durationSeconds,omitempty"`
Progress MigrationProgress `json:"progress"`
Result *MigrationResponse `json:"result,omitempty"`
Error string `json:"error,omitempty"`
}
MigrationJobStatus represents the current state of migration job
type MigrationProgress ¶ added in v1.0.10
type MigrationProgress struct {
TotalTags int `json:"totalTags"`
ProcessedTags int `json:"processedTags"`
CurrentTag string `json:"currentTag,omitempty"`
SuccessCount int `json:"successCount"`
FailureCount int `json:"failureCount"`
SkippedCount int `json:"skippedCount"`
CurrentTagTotalMembers int `json:"currentTagTotalMembers,omitempty"`
CurrentTagMembersWritten int `json:"currentTagMembersWritten,omitempty"`
CurrentTagMembersMissingInXdas int `json:"currentTagMembersMissingInXdas,omitempty"`
}
MigrationProgress tracks real-time progress of migration
type MigrationResponse ¶ added in v1.0.10
type MigrationResponse struct {
Status string `json:"status"`
Summary MigrationSummary `json:"summary"`
FailedTags []string `json:"failedTags,omitempty"`
SkippedTags []TagMigrationSkip `json:"skippedTags,omitempty"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
DurationSeconds float64 `json:"durationSeconds"`
}
MigrationResponse represents the response for an actual migration
type MigrationSummary ¶ added in v1.0.10
type MigrationSummary struct {
TotalTags int `json:"totalTags"`
SuccessCount int `json:"successCount"`
FailureCount int `json:"failureCount"`
SkippedCount int `json:"skippedCount"`
TotalMembers int `json:"totalMembers"`
TotalMembersWritten int `json:"totalMembersWritten"`
TotalMembersMissingInXdas int `json:"totalMembersMissingInXdas"`
}
MigrationSummary provides overall statistics for migration
type PaginatedMembersResponse ¶ added in v1.0.10
type PaginatedMembersResponse struct {
Data []string `json:"data"`
NextCursor string `json:"nextCursor,omitempty"`
HasMore bool `json:"hasMore"`
}
func GetMembersV2Paginated ¶ added in v1.0.10
func GetMembersV2Paginated(tagId string, limit int, cursor string) (*PaginatedMembersResponse, error)
type PaginationParams ¶ added in v1.0.10
type TagMemberStats ¶ added in v1.0.10
TagMemberStats represents member statistics for a tag migration
type TagMigrationSkip ¶ added in v1.0.10
TagMigrationSkip represents a skipped tag with reason