bulk

package
v1.1.48 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: AGPL-3.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bulk provides bulk operation services for the Lesser ActivityPub server.

This service handles all bulk operations including: - Bulk follow/unfollow operations - Bulk mute/unmute operations - Bulk block/unblock operations - Bulk status deletion - Bulk list member management - Progress tracking and event emission for real-time updates

Index

Constants

View Source
const (
	StatusCompleted = "completed"
	StatusStatus    = "status"
)

Constants for bulk operations

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveCommand

type ArchiveCommand struct {
	Username    string     `json:"username" validate:"required"`
	ContentIDs  []string   `json:"content_ids" validate:"required,min=1,max=100"`
	ContentType string     `json:"content_type"` // "status", "media", "all" - defaults to "status"
	DateRange   *DateRange `json:"date_range"`
}

ArchiveCommand contains data for bulk content archiving

type BlockCommand

type BlockCommand struct {
	Username   string   `json:"username" validate:"required"`
	AccountIDs []string `json:"account_ids" validate:"required,min=1,max=100"`
}

BlockCommand contains data for bulk block operations

type DateRange

type DateRange struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

DateRange specifies a time range for operations

type DeleteCommand

type DeleteCommand struct {
	Username    string     `json:"username" validate:"required"`
	ContentIDs  []string   `json:"content_ids" validate:"required,min=1,max=100"`
	ContentType string     `json:"content_type"` // "status", "media", "all" - defaults to "status"
	DateRange   *DateRange `json:"date_range"`
	Permanent   bool       `json:"permanent"` // If true, permanently delete; if false, soft delete
}

DeleteCommand contains data for bulk content deletion

type DeleteStatusesCommand

type DeleteStatusesCommand struct {
	Username   string     `json:"username" validate:"required"`
	StatusIDs  []string   `json:"status_ids" validate:"required,min=1,max=100"`
	DateRange  *DateRange `json:"date_range"`
	KeepPinned bool       `json:"keep_pinned"`
}

DeleteStatusesCommand contains data for bulk status deletion

type ExportCommand

type ExportCommand struct {
	Username     string     `json:"username" validate:"required"`
	ContentIDs   []string   `json:"content_ids" validate:"required,min=1,max=100"`
	Format       string     `json:"format" validate:"required"` // "json", "csv", "activitypub"
	ContentType  string     `json:"content_type"`               // "status", "media", "all" - defaults to "status"
	IncludeMedia bool       `json:"include_media"`
	DateRange    *DateRange `json:"date_range"`
}

ExportCommand contains data for bulk content export

type FederationService

type FederationService interface {
	QueueActivity(ctx context.Context, activity *activitypub.Activity) error
}

FederationService defines the interface for federation operations

type FollowCommand

type FollowCommand struct {
	Username   string   `json:"username" validate:"required"`
	AccountIDs []string `json:"account_ids" validate:"required,min=1,max=100"`
	Reblogs    bool     `json:"reblogs"`
	Notify     bool     `json:"notify"`
	Languages  []string `json:"languages"`
}

FollowCommand contains data for bulk follow operations

type GetOperationQuery

type GetOperationQuery struct {
	OperationID string `json:"operation_id" validate:"required"`
	Username    string `json:"username" validate:"required"` // For authorization
}

GetOperationQuery retrieves the status of a bulk operation

type ListMembersCommand

type ListMembersCommand struct {
	Username   string   `json:"username" validate:"required"`
	ListID     string   `json:"list_id" validate:"required"`
	AccountIDs []string `json:"account_ids" validate:"required,min=1,max=100"`
	Operation  string   `json:"operation" validate:"required,oneof=add remove"`
}

ListMembersCommand contains data for bulk list member operations

type MuteCommand

type MuteCommand struct {
	Username      string         `json:"username" validate:"required"`
	AccountIDs    []string       `json:"account_ids" validate:"required,min=1,max=100"`
	Notifications bool           `json:"notifications"`
	Duration      *time.Duration `json:"duration"`
}

MuteCommand contains data for bulk mute operations

type Operation

type Operation struct {
	ID          string            `json:"id"`
	Type        string            `json:"type"`
	Username    string            `json:"username"`
	Status      string            `json:"status"` // pending, processing, completed, failed
	Total       int               `json:"total"`
	Processed   int               `json:"processed"`
	Succeeded   int               `json:"succeeded"`
	Failed      int               `json:"failed"`
	Errors      []string          `json:"errors,omitempty"`
	StartedAt   time.Time         `json:"started_at"`
	CompletedAt *time.Time        `json:"completed_at,omitempty"`
	Events      []streaming.Event `json:"-"`
}

Operation tracks the progress of a bulk operation

type OperationResult

type OperationResult struct {
	Operation *Operation        `json:"operation"`
	Events    []streaming.Event `json:"-"`
}

OperationResult contains the result of a bulk operation

type RestoreCommand

type RestoreCommand struct {
	Username    string     `json:"username" validate:"required"`
	ContentIDs  []string   `json:"content_ids" validate:"required,min=1,max=100"`
	ContentType string     `json:"content_type"` // "status", "media", "all" - defaults to "status"
	DateRange   *DateRange `json:"date_range"`
}

RestoreCommand contains data for bulk content restoration

type Service

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

Service provides business logic for bulk operations

func NewService

func NewService(
	statusRepo interfaces.StatusRepository,
	accountRepo interfaces.AccountRepository,
	socialRepo interfaces.SocialRepository,
	listRepo *repositories.ListRepository,
	relationshipRepo interfaces.ConcreteRelationshipRepository,
	publisher streaming.Publisher,
	federation FederationService,
	logger *zap.Logger,
	domain string,
) *Service

NewService creates a new bulk operations service

func (*Service) BulkArchive

func (s *Service) BulkArchive(ctx context.Context, cmd *ArchiveCommand) (*OperationResult, error)

BulkArchive performs bulk content archiving operations

func (*Service) BulkBlock

func (s *Service) BulkBlock(ctx context.Context, cmd *BlockCommand) (*OperationResult, error)

BulkBlock performs bulk account blocking operations

func (*Service) BulkDelete

func (s *Service) BulkDelete(ctx context.Context, cmd *DeleteCommand) (*OperationResult, error)

BulkDelete performs bulk content deletion operations

func (*Service) BulkDeleteStatuses

func (s *Service) BulkDeleteStatuses(ctx context.Context, cmd *DeleteStatusesCommand) (*OperationResult, error)

BulkDeleteStatuses performs bulk status deletion

func (*Service) BulkExport

func (s *Service) BulkExport(ctx context.Context, cmd *ExportCommand) (*OperationResult, error)

BulkExport performs bulk content export operations

func (*Service) BulkFollow

func (s *Service) BulkFollow(ctx context.Context, cmd *FollowCommand) (*OperationResult, error)

BulkFollow performs bulk follow operations

func (*Service) BulkListMembers

func (s *Service) BulkListMembers(ctx context.Context, cmd *ListMembersCommand) (*OperationResult, error)

BulkListMembers performs bulk list member operations (add/remove)

func (*Service) BulkMute

func (s *Service) BulkMute(ctx context.Context, cmd *MuteCommand) (*OperationResult, error)

BulkMute performs bulk account muting operations

func (*Service) BulkRestore

func (s *Service) BulkRestore(ctx context.Context, cmd *RestoreCommand) (*OperationResult, error)

BulkRestore performs bulk content restoration operations

func (*Service) BulkUnblock

func (s *Service) BulkUnblock(ctx context.Context, cmd *UnblockCommand) (*OperationResult, error)

BulkUnblock performs bulk account unblocking operations

func (*Service) GetOperation

func (s *Service) GetOperation(_ context.Context, query *GetOperationQuery) (*OperationResult, error)

GetOperation retrieves the status of a bulk operation

type UnblockCommand

type UnblockCommand struct {
	Username   string   `json:"username" validate:"required"`
	AccountIDs []string `json:"account_ids" validate:"required,min=1,max=100"`
}

UnblockCommand contains data for bulk unblock operations

type UnfollowCommand

type UnfollowCommand struct {
	Username   string   `json:"username" validate:"required"`
	AccountIDs []string `json:"account_ids" validate:"required,min=1,max=100"`
}

UnfollowCommand contains data for bulk unfollow operations

type UnmuteCommand

type UnmuteCommand struct {
	Username   string   `json:"username" validate:"required"`
	AccountIDs []string `json:"account_ids" validate:"required,min=1,max=100"`
}

UnmuteCommand contains data for bulk unmute operations

Jump to

Keyboard shortcuts

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