-
Notifications
You must be signed in to change notification settings - Fork 0
Database Interaction
Simon Gibson edited this page Sep 4, 2024
·
1 revision
VidToNerf uses MongoDB as its database. The database is named nerfdb
and contains the following collections:
scenes
users
queues
The scenes
collection stores information about each scene processed by the system.
{
_id: ObjectId,
video: {
file_path: String,
width: Number,
height: Number,
fps: Number,
duration: Number,
frame_count: Number
},
sfm: {
intrinsic_matrix: [[Number]],
frames: [
{
file_path: String,
extrinsic_matrix: [[Number]]
}
],
white_background: Boolean
},
config: {
sfm_training_config: {
// Add fields as needed
},
nerf_training_config: {
training_mode: String,
output_types: [String],
save_iterations: [Number],
total_iterations: Number
}
},
nerf: {
model_file_paths: {
[iteration: Number]: String
},
splat_cloud_file_paths: {
[iteration: Number]: String
},
point_cloud_file_paths: {
[iteration: Number]: String
},
video_file_paths: {
[iteration: Number]: String
},
flag: Number
},
status: Number,
name: String
}
The users
collection stores user information.
{
_id: ObjectId,
username: String,
encrypted_password: String,
scene_ids: [ObjectId]
}
The queues
collection stores information about processing queues.
{
_id: String,
queue: [ObjectId]
}
The SceneManager
is responsible for interacting with the scenes
collection.
SetTrainingConfig(ctx, id, config)
SetScene(ctx, id, scene)
SetVideo(ctx, id, vid)
SetSfm(ctx, id, sfm)
SetNerf(ctx, id, nerf)
SetSceneName(ctx, id, name)
GetSceneName(ctx, id)
GetTrainingConfig(ctx, id)
GetScene(ctx, id)
GetVideo(ctx, id)
GetSfm(ctx, id)
GetNerf(ctx, id)
DeleteScene(ctx, id)
The UserManager
is responsible for interacting with the users
collection.
SetUser(ctx, user)
UpdateUser(ctx, user)
GenerateUser(ctx, username, password)
GetUserByID(ctx, userID)
GetUserByUsername(ctx, username)
UserHasJobAccess(ctx, userID, jobID)
UpdatePassword(ctx, userID, oldPassword, newPassword)
UpdateUsername(ctx, userID, userPassword, newUsername)
The QueueListManager
is responsible for interacting with the queues
collection.
AddNewQueue(ctx, queueID)
GetQueuePosition(ctx, queueID, itemID)
GetQueueSize(ctx, queueID)
AppendToQueue(ctx, queueID, itemID)
DeleteFromQueue(ctx, queueID, itemID)
Custom errors are defined for various scenarios:
ErrSceneNotFound
ErrVideoNotFound
ErrSfmNotFound
ErrNerfNotFound
ErrTrainingConfigNotFound
ErrUserNotFound
ErrUsernameTaken
ErrUserNoAccess
ErrInvalidQueueID
ErrQueueAlreadyExists
ErrIDAlreadyInQueue
ErrIDNotFoundInQueue
ErrMultipleIDsInQueue
ErrInvalidOpOnEmptyQueue
These errors should be handled appropriately in the application logic.
- Ensure that all database credentials are securely stored and not exposed in the codebase.
- Use environment variables or secure secret management systems for storing sensitive information.
- Implement proper access controls and authentication mechanisms for database access.