From 23dd69e060552047a0a124165258105615b13dd9 Mon Sep 17 00:00:00 2001 From: Kato Twofold Date: Wed, 1 Jun 2022 11:32:12 +0300 Subject: [PATCH] + Added some comments --- lib/objects/objects_post.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/objects/objects_post.go b/lib/objects/objects_post.go index 035d9b5..e905156 100644 --- a/lib/objects/objects_post.go +++ b/lib/objects/objects_post.go @@ -16,6 +16,7 @@ type Post struct { Content string `json:"content"` } +// Get the path to the storage directory func getStorageDirectory() string { baseStoragePath, exists := os.LookupEnv("PAD_STORAGE_PATH") @@ -38,6 +39,7 @@ func getStorageDirectory() string { return baseStoragePath } +// Get a post from the file system func GetPost(fileName string) Post { // Get the base storage directory and make sure it exists storageDir := getStorageDirectory() @@ -74,6 +76,7 @@ func GetPost(fileName string) Post { return p } +// Write a post to the file system func WritePost(p Post) error { maximumPadSize := helper.GetMaximumPadSize() @@ -105,6 +108,7 @@ func WritePost(p Post) error { return nil } +// Cleanup all of the older posts based on the environment settings func CleanupPosts(age int) { // Initialize the files buffer var files []string @@ -155,5 +159,4 @@ func CleanupPosts(age int) { } } - }