Removed the serviceInitialisationInformation give a ServiceID, because it's not needed

Signed-off-by: Arzumify <jliwin98@danwin1210.de>
This commit is contained in:
Tracker-Friendly 2024-10-02 17:07:01 +01:00
parent 766a1c6ba6
commit ddc47748fc
4 changed files with 23 additions and 28 deletions

View File

@ -30,7 +30,6 @@ type InterServiceMessage struct {
} }
type ServiceInitializationInformation struct { type ServiceInitializationInformation struct {
ServiceID uuid.UUID `validate:"required"`
Domain string `validate:"required"` Domain string `validate:"required"`
Outbox chan<- InterServiceMessage `validate:"required"` Outbox chan<- InterServiceMessage `validate:"required"`
Inbox <-chan InterServiceMessage `validate:"required"` Inbox <-chan InterServiceMessage `validate:"required"`

View File

@ -521,7 +521,6 @@ func main() {
} }
storageMain.(func(library.ServiceInitializationInformation))(library.ServiceInitializationInformation{ storageMain.(func(library.ServiceInitializationInformation))(library.ServiceInitializationInformation{
ServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000003"),
Domain: "", Domain: "",
Configuration: config.Services["storage"].(map[string]interface{}), Configuration: config.Services["storage"].(map[string]interface{}),
Outbox: globalOutbox, Outbox: globalOutbox,
@ -576,7 +575,6 @@ func main() {
} }
authMain.(func(library.ServiceInitializationInformation))(library.ServiceInitializationInformation{ authMain.(func(library.ServiceInitializationInformation))(library.ServiceInitializationInformation{
ServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000004"),
Domain: "", Domain: "",
Configuration: config.Services["auth"].(map[string]interface{}), Configuration: config.Services["auth"].(map[string]interface{}),
Outbox: globalOutbox, Outbox: globalOutbox,
@ -664,7 +662,6 @@ func main() {
// Check if they want a resource directory // Check if they want a resource directory
if serviceInformation.(*library.Service).Permissions.Resources { if serviceInformation.(*library.Service).Permissions.Resources {
main.(func(library.ServiceInitializationInformation))(library.ServiceInitializationInformation{ main.(func(library.ServiceInitializationInformation))(library.ServiceInitializationInformation{
ServiceID: serviceInformation.(*library.Service).ServiceID,
Domain: serviceInformation.(*library.Service).Name, Domain: serviceInformation.(*library.Service).Name,
Configuration: config.Services[serviceInformation.(*library.Service).Name].(map[string]interface{}), Configuration: config.Services[serviceInformation.(*library.Service).Name].(map[string]interface{}),
Outbox: globalOutbox, Outbox: globalOutbox,
@ -674,7 +671,6 @@ func main() {
}) })
} else { } else {
main.(func(library.ServiceInitializationInformation))(library.ServiceInitializationInformation{ main.(func(library.ServiceInitializationInformation))(library.ServiceInitializationInformation{
ServiceID: serviceInformation.(*library.Service).ServiceID,
Domain: serviceInformation.(*library.Service).Name, Domain: serviceInformation.(*library.Service).Name,
Configuration: config.Services[serviceInformation.(*library.Service).Name].(map[string]interface{}), Configuration: config.Services[serviceInformation.(*library.Service).Name].(map[string]interface{}),
Outbox: globalOutbox, Outbox: globalOutbox,

View File

@ -53,7 +53,7 @@ var serviceIDBytes []byte
func logFunc(message string, messageType uint64, information library.ServiceInitializationInformation) { func logFunc(message string, messageType uint64, information library.ServiceInitializationInformation) {
// Log the message to the logger service // Log the message to the logger service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000002"), // Logger service ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000002"), // Logger service
MessageType: messageType, MessageType: messageType,
SentAt: time.Now(), SentAt: time.Now(),
@ -185,7 +185,7 @@ func Main(information library.ServiceInitializationInformation) {
// Initiate a connection to the database // Initiate a connection to the database
// Call service ID 1 to get the database connection information // Call service ID 1 to get the database connection information
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000001"), // Service initialization service ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000001"), // Service initialization service
MessageType: 1, // Request connection information MessageType: 1, // Request connection information
SentAt: time.Now(), SentAt: time.Now(),

View File

@ -90,7 +90,7 @@ func getUsed(user uuid.UUID, information library.ServiceInitializationInformatio
func logFunc(message string, messageType uint64, information library.ServiceInitializationInformation) { func logFunc(message string, messageType uint64, information library.ServiceInitializationInformation) {
// Log the error message to the logger service // Log the error message to the logger service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000002"), // Logger service ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000002"), // Logger service
MessageType: messageType, MessageType: messageType,
SentAt: time.Now(), SentAt: time.Now(),
@ -107,7 +107,7 @@ func storeFile(file InsertFile, serviceID uuid.UUID, information library.Service
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -123,7 +123,7 @@ func storeFile(file InsertFile, serviceID uuid.UUID, information library.Service
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -138,7 +138,7 @@ func storeFile(file InsertFile, serviceID uuid.UUID, information library.Service
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -150,7 +150,7 @@ func storeFile(file InsertFile, serviceID uuid.UUID, information library.Service
if used+file.File.Size > quota { if used+file.File.Size > quota {
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 3, // It's the user's fault (never say that to the customer ;P) MessageType: 3, // It's the user's fault (never say that to the customer ;P)
SentAt: time.Now(), SentAt: time.Now(),
@ -166,7 +166,7 @@ func storeFile(file InsertFile, serviceID uuid.UUID, information library.Service
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -182,7 +182,7 @@ func storeFile(file InsertFile, serviceID uuid.UUID, information library.Service
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -198,7 +198,7 @@ func storeFile(file InsertFile, serviceID uuid.UUID, information library.Service
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -214,7 +214,7 @@ func storeFile(file InsertFile, serviceID uuid.UUID, information library.Service
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -224,7 +224,7 @@ func storeFile(file InsertFile, serviceID uuid.UUID, information library.Service
// Report success // Report success
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 0, // Success MessageType: 0, // Success
SentAt: time.Now(), SentAt: time.Now(),
@ -241,7 +241,7 @@ func readFile(file ReadFile, serviceID uuid.UUID, information library.ServiceIni
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -257,7 +257,7 @@ func readFile(file ReadFile, serviceID uuid.UUID, information library.ServiceIni
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -273,7 +273,7 @@ func readFile(file ReadFile, serviceID uuid.UUID, information library.ServiceIni
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -283,7 +283,7 @@ func readFile(file ReadFile, serviceID uuid.UUID, information library.ServiceIni
// Report success // Report success
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 0, // Success MessageType: 0, // Success
SentAt: time.Now(), SentAt: time.Now(),
@ -300,7 +300,7 @@ func removeFile(file File, serviceID uuid.UUID, information library.ServiceIniti
// Then send the error message to the requesting service // Then send the error message to the requesting service
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 1, // An error that's not your fault MessageType: 1, // An error that's not your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -310,7 +310,7 @@ func removeFile(file File, serviceID uuid.UUID, information library.ServiceIniti
// Report success // Report success
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: serviceID, ForServiceID: serviceID,
MessageType: 0, // Success MessageType: 0, // Success
SentAt: time.Now(), SentAt: time.Now(),
@ -335,7 +335,7 @@ func Main(information library.ServiceInitializationInformation) {
err := validate.Struct(message.Message.(InsertFile)) err := validate.Struct(message.Message.(InsertFile))
if err != nil { if err != nil {
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: message.ServiceID, ForServiceID: message.ServiceID,
MessageType: 2, // An error that's your fault MessageType: 2, // An error that's your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -351,7 +351,7 @@ func Main(information library.ServiceInitializationInformation) {
err := validate.Struct(message.Message.(ReadFile)) err := validate.Struct(message.Message.(ReadFile))
if err != nil { if err != nil {
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: message.ServiceID, ForServiceID: message.ServiceID,
MessageType: 2, // An error that's your fault MessageType: 2, // An error that's your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -367,7 +367,7 @@ func Main(information library.ServiceInitializationInformation) {
err := validate.Struct(message.Message.(File)) err := validate.Struct(message.Message.(File))
if err != nil { if err != nil {
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: message.ServiceID, ForServiceID: message.ServiceID,
MessageType: 2, // An error that's your fault MessageType: 2, // An error that's your fault
SentAt: time.Now(), SentAt: time.Now(),
@ -385,7 +385,7 @@ func Main(information library.ServiceInitializationInformation) {
// Initiate a connection to the database // Initiate a connection to the database
// Call service ID 1 to get the database connection information // Call service ID 1 to get the database connection information
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000001"), // Service initialization service ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000001"), // Service initialization service
MessageType: 1, // Request connection information MessageType: 1, // Request connection information
SentAt: time.Now(), SentAt: time.Now(),
@ -411,7 +411,7 @@ func Main(information library.ServiceInitializationInformation) {
// Report a successful activation // Report a successful activation
information.Outbox <- library.InterServiceMessage{ information.Outbox <- library.InterServiceMessage{
ServiceID: information.ServiceID, ServiceID: ServiceInformation.ServiceID,
ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000001"), // Activation service ForServiceID: uuid.MustParse("00000000-0000-0000-0000-000000000001"), // Activation service
MessageType: 0, MessageType: 0,
SentAt: time.Now(), SentAt: time.Now(),