Skip to content

Commit 442d971

Browse files
committed
initial commit
1 parent f139355 commit 442d971

File tree

2 files changed

+43
-43
lines changed

2 files changed

+43
-43
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: boat
1+
name: boat-ci
22
on:
33
push:
44
branches: [develop, deploy]

src/boat/private/FileManager.nim

+42-42
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,56 @@
33
## ===========
44
## Saving to and Retrieving from disk
55

6-
import ../../../bdd
6+
# import ../../../bdd
77

88
# valgrind throws if this file is imported into ./Config.nim
99
import std/[
1010
asyncdispatch, # causes valgrind to throw
11-
locks,
11+
# locks,
1212
threadpool, # causes valgrind to throw
1313
]
1414

1515
import BoatConstants, BoatErrors
1616

1717
# export asyncdispatch
1818

19-
type SaveType* = enum
20-
parsedConfig,
21-
upsertManifest,
22-
remoteManifest,
23-
24-
proc fileDir*(self: SaveType): string =
25-
result = case self
26-
of parsedConfig, upsertManifest: cacheDir
27-
else: tempDir
28-
29-
proc toDisk*[T](
30-
self: SaveType,
31-
fname: string,
32-
data: T,
33-
): Future[string] {.async.} =
34-
## persists data to cache or temp dir and returns path
35-
## if file already exists, will overwrite if content is different
36-
raise tddError
37-
# file exists ?
38-
# content is same? return true
39-
# persist data
40-
# lock
41-
# save as self.fileDir / hash(fname)
42-
# unlock
43-
# return success
44-
result = true
45-
46-
proc fromDisk*[T](
47-
self: SaveType,
48-
fname: string,
49-
to: T,
50-
errorNotFound = false
51-
): Future[T] {.async.} =
52-
## parse to T and return T
53-
## throws if errorNotFound is true; else returns empty T
54-
raise tddError
55-
# yield readAsync self.fileDir / hash(fname)
56-
# if file not found / cant be read then throw if errorNotFound is true
57-
if errorNotFound and "cant load file" is string: raise fileLoadError
58-
else: result = new(to)
19+
# type SaveType* = enum
20+
# parsedConfig,
21+
# upsertManifest,
22+
# remoteManifest,
23+
24+
# proc fileDir*(self: SaveType): string =
25+
# result = case self
26+
# of parsedConfig, upsertManifest: cacheDir
27+
# else: tempDir
28+
29+
# proc toDisk*[T](
30+
# self: SaveType,
31+
# fname: string,
32+
# data: T,
33+
# ): Future[string] {.async.} =
34+
# ## persists data to cache or temp dir and returns path
35+
# ## if file already exists, will overwrite if content is different
36+
# raise tddError
37+
# # file exists ?
38+
# # content is same? return true
39+
# # persist data
40+
# # lock
41+
# # save as self.fileDir / hash(fname)
42+
# # unlock
43+
# # return success
44+
# result = true
45+
46+
# proc fromDisk*[T](
47+
# self: SaveType,
48+
# fname: string,
49+
# to: T,
50+
# errorNotFound = false
51+
# ): Future[T] {.async.} =
52+
# ## parse to T and return T
53+
# ## throws if errorNotFound is true; else returns empty T
54+
# raise tddError
55+
# # yield readAsync self.fileDir / hash(fname)
56+
# # if file not found / cant be read then throw if errorNotFound is true
57+
# if errorNotFound and "cant load file" is string: raise fileLoadError
58+
# else: result = new(to)

0 commit comments

Comments
 (0)