Skip to content

Commit

Permalink
Updates comment
Browse files Browse the repository at this point in the history
  • Loading branch information
delldubey committed Aug 9, 2023
1 parent 9460a9c commit 56e4a43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"
)

// constants to be used in APIs
const (
XFile = "file/"
XFileSystem = "/file_system"
Expand Down Expand Up @@ -125,6 +126,7 @@ func (c *Client) CreateFileSystem(ctx context.Context, symID, name, nasServer, s
return fileSystem, nil
}

// ModifyFileSystem modifies the given file system
func (c *Client) ModifyFileSystem(ctx context.Context, symID, fsID string, payload types.ModifyFileSystem) (*types.FileSystem, error) {
defer c.TimeSpent("ModifyFileSystem", time.Now())
if _, err := c.IsAllowedArray(symID); err != nil {
Expand Down
15 changes: 14 additions & 1 deletion mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,9 @@ func initMockCache() {
AddFileObjects()
}

// AddFileObjects adds file objects for mock objects
func AddFileObjects() {
// Add a file system
// Add a File System
AddNewFileSystem("id1", "fs-1", 4000)
// Add a NFS Export
AddNewNFSExport("id1", "nfs-0")
Expand Down Expand Up @@ -4319,6 +4320,7 @@ func handleNASServer(w http.ResponseWriter, r *http.Request) {
}
}

// UpdateNASServer updates NAS server
func UpdateNASServer(nasID string, payload types.ModifyNASServer) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand All @@ -4332,6 +4334,7 @@ func updateNASServer(nasID, newName string) {
Data.NASServerIDToNASServer[nasID] = nas
}

// ReturnNASServer returns NAS server object
func ReturnNASServer(w http.ResponseWriter, nasID string) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand Down Expand Up @@ -4426,6 +4429,7 @@ func handleNFSExport(w http.ResponseWriter, r *http.Request) {
}
}

// RemoveNFSExport removes NFS export object
func RemoveNFSExport(w http.ResponseWriter, nfsID string) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand All @@ -4441,6 +4445,7 @@ func removeNFSExport(w http.ResponseWriter, nfsID string) {
return
}

// UpdateNFSExport updates NFS Export
func UpdateNFSExport(id string, payload types.ModifyNFSExport) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand All @@ -4454,6 +4459,7 @@ func updateNFSExport(nfsID, newName string) {
Data.NFSExportIDToNFSExport[nfsID] = nfs
}

// ReturnNFSExport NFS export
func ReturnNFSExport(w http.ResponseWriter, nfsID string) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand Down Expand Up @@ -4556,6 +4562,7 @@ func handleFileSystem(w http.ResponseWriter, r *http.Request) {
}
}

// ReturnFileSystem returns File System object
func ReturnFileSystem(w http.ResponseWriter, fsID string) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand Down Expand Up @@ -4603,6 +4610,7 @@ func returnFileSystem(w http.ResponseWriter, fsID string) {
}
}

// RemoveFileSystem removes File system from mock
func RemoveFileSystem(w http.ResponseWriter, fsID string) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand All @@ -4618,6 +4626,7 @@ func removeFileSystem(w http.ResponseWriter, fsID string) {
return
}

// RemoveNASServer removes NAS server
func RemoveNASServer(w http.ResponseWriter, nasID string) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand All @@ -4633,6 +4642,7 @@ func removeNASServer(w http.ResponseWriter, nasID string) {
return
}

// AddNewNASServer adds new NAS server into mock
func AddNewNASServer(id, name string) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand Down Expand Up @@ -4664,6 +4674,7 @@ func newNASServer(nasID, nasName string) *types.NASServer {
}
}

// AddNewNFSExport new NFS Export into mock
func AddNewNFSExport(id, name string) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand Down Expand Up @@ -4697,6 +4708,7 @@ func newNFSExport(nfsID, nfsName string) *types.NFSExport {
}
}

// AddNewFileSystem adds a new file system into mock
func AddNewFileSystem(id, name string, sizeInMiB int64) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand All @@ -4707,6 +4719,7 @@ func addNewFileSystem(fsID, fsName string, sizeInMiB int64) {
Data.FileSysIDToFileSystem[fsID] = newFileSystem(fsID, fsName, sizeInMiB)
}

// UpdateFileSystem updates an existing FileSystem
func UpdateFileSystem(id string, payload types.ModifyFileSystem) {
mockCacheMutex.Lock()
defer mockCacheMutex.Unlock()
Expand Down

0 comments on commit 56e4a43

Please sign in to comment.