event

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EVENT_BOOT_COMPLETE = "boot.complete"
)
View Source
const (
	EVENT_CONFIG_PROPERTY_UPDATE = "config.property.update"
)
View Source
const EVENT_DOWNLOAD_COMPLETED = "download.completed"
View Source
const (
	EVENT_STORAGE_OBJECT_PINNED = "storage.object.pinned"
)
View Source
const (
	EVENT_STORAGE_OBJECT_UNPINNED = "storage.object.unpinned"
)
View Source
const (
	EVENT_USER_ACTIVATED = "user.activated"
)
View Source
const (
	EVENT_USER_CREATED = "user.created"
)
View Source
const (
	EVENT_USER_SERVICE_SUBDOMAIN_SET = "user.subdomain.set"
)

Variables

This section is empty.

Functions

func AssertEventType

func AssertEventType[T event.Event](evt event.Event, eventName string) (T, error)

func DoFire

func DoFire(
	ctx core.Context,
	event event.Event,
	async bool,
) error

func EventHandler

func EventHandler[T event.Event](eventName string, handler func(T) error) event.ListenerFunc

func Fire

func Fire[T event.Event](
	ctx core.Context,
	eventName string,
	cb func(evt T) error,
) error

func FireAsync

func FireAsync[T event.Event](
	ctx core.Context,
	eventName string,
	cb func(evt T) error,
) error

func FireBootCompleteEvent

func FireBootCompleteEvent(ctx core.Context) error

func FireConfigPropertyUpdateEvent

func FireConfigPropertyUpdateEvent(ctx core.Context, key string, value interface{}, category config.ConfigPropertyUpdateCategory, entity string, subEntity string) error

func FireDownloadCompletedEvent

func FireDownloadCompletedEvent(ctx core.Context, uploadID uint, bytes uint64, ip string) error

func FireDownloadCompletedEventAsync

func FireDownloadCompletedEventAsync(ctx core.Context, uploadID uint, bytes uint64, ip string) error

func FireStorageObjectUnpinnedEvent

func FireStorageObjectUnpinnedEvent(ctx core.Context, pin *models.Pin) error

func FireStorageObjectUploadedEvent

func FireStorageObjectUploadedEvent(ctx core.Context, pin *models.Pin, ip string) error

func FireUseServicerSubdomainSetEvent

func FireUseServicerSubdomainSetEvent(ctx core.Context, subdomain string) error

func FireUserActivatedEvent

func FireUserActivatedEvent(ctx core.Context, user *models.User) error

func FireUserCreatedEvent

func FireUserCreatedEvent(ctx core.Context, user *models.User) error

func GetEvent

func GetEvent(ctx core.Context, eventName string) (event.Event, error)

Helper function to get and check an event

func Listen

func Listen[T event.Event](
	ctx core.Context,
	eventName string,
	handler func(T) error,
)

func SetupFire

func SetupFire[T event.Event](
	ctx core.Context,
	eventName string,
) (T, error)

Types

type BootCompleteEvent

type BootCompleteEvent struct {
	core.Event
}

func (BootCompleteEvent) Context

func (e BootCompleteEvent) Context() core.Context

func (*BootCompleteEvent) SetContext

func (e *BootCompleteEvent) SetContext(ctx core.Context)

type ConfigPropertyUpdateEvent

type ConfigPropertyUpdateEvent struct {
	core.Event
}

func (ConfigPropertyUpdateEvent) Category

func (ConfigPropertyUpdateEvent) Entity

func (e ConfigPropertyUpdateEvent) Entity() string

func (ConfigPropertyUpdateEvent) PropertyKey

func (e ConfigPropertyUpdateEvent) PropertyKey() string

func (ConfigPropertyUpdateEvent) PropertyValue

func (e ConfigPropertyUpdateEvent) PropertyValue() interface{}

func (*ConfigPropertyUpdateEvent) SetCategory

func (ConfigPropertyUpdateEvent) SetEntity

func (e ConfigPropertyUpdateEvent) SetEntity(entity string)

func (*ConfigPropertyUpdateEvent) SetProperty

func (e *ConfigPropertyUpdateEvent) SetProperty(key string, value interface{})

func (ConfigPropertyUpdateEvent) SetSubEntity

func (e ConfigPropertyUpdateEvent) SetSubEntity(subEntity string)

func (ConfigPropertyUpdateEvent) SubEntity

func (e ConfigPropertyUpdateEvent) SubEntity() string

type DownloadCompletedEvent

type DownloadCompletedEvent struct {
	core.Event
}

func (DownloadCompletedEvent) Bytes

func (e DownloadCompletedEvent) Bytes() uint64

func (DownloadCompletedEvent) IP

func (*DownloadCompletedEvent) SetBytes

func (e *DownloadCompletedEvent) SetBytes(size uint64)

func (*DownloadCompletedEvent) SetIP

func (e *DownloadCompletedEvent) SetIP(ip string)

func (*DownloadCompletedEvent) SetUploadID

func (e *DownloadCompletedEvent) SetUploadID(uploadID uint)

func (DownloadCompletedEvent) UploadID

func (e DownloadCompletedEvent) UploadID() uint

type StorageObjectPinnedEvent

type StorageObjectPinnedEvent struct {
	core.Event
}

func (StorageObjectPinnedEvent) IP

func (StorageObjectPinnedEvent) Pin

func (*StorageObjectPinnedEvent) SetIP

func (e *StorageObjectPinnedEvent) SetIP(ip string)

func (*StorageObjectPinnedEvent) SetPin

func (e *StorageObjectPinnedEvent) SetPin(metadata *models.Pin)

type StorageObjectUnpinnedEvent

type StorageObjectUnpinnedEvent struct {
	core.Event
}

func (StorageObjectUnpinnedEvent) IP

func (StorageObjectUnpinnedEvent) Pin

func (*StorageObjectUnpinnedEvent) SetPin

func (e *StorageObjectUnpinnedEvent) SetPin(metadata *models.Pin)

type UserActivatedEvent

type UserActivatedEvent struct {
	core.Event
}

func (*UserActivatedEvent) SetUser

func (e *UserActivatedEvent) SetUser(user *models.User)

func (UserActivatedEvent) User

func (e UserActivatedEvent) User() *models.User

type UserCreatedEvent

type UserCreatedEvent struct {
	core.Event
}

func (*UserCreatedEvent) SetUser

func (e *UserCreatedEvent) SetUser(user *models.User)

func (UserCreatedEvent) User

func (e UserCreatedEvent) User() *models.User

type UserServiceSubdomainSetEvent

type UserServiceSubdomainSetEvent struct {
	core.Event
}

func (*UserServiceSubdomainSetEvent) SetSubdomain

func (e *UserServiceSubdomainSetEvent) SetSubdomain(subdomain string)

func (UserServiceSubdomainSetEvent) Subdomain

func (e UserServiceSubdomainSetEvent) Subdomain() string

Jump to

Keyboard shortcuts

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