Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
ac530d0a
Commit
ac530d0a
authored
Jan 14, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(fsrepo) move Close under Open
parent
70dab069
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
repo/fsrepo/fsrepo.go
repo/fsrepo/fsrepo.go
+12
-11
No files found.
repo/fsrepo/fsrepo.go
View file @
ac530d0a
...
...
@@ -72,6 +72,7 @@ func ConfigAt(repoPath string) (*config.Config, error) {
}
// Init initializes a new FSRepo at the given path with the provided config.
// TODO add support for custom datastores.
func
Init
(
path
string
,
conf
*
config
.
Config
)
error
{
// packageLock must be held to ensure that the repo is not initialized more
...
...
@@ -175,6 +176,17 @@ func (r *FSRepo) Open() error {
return
transitionToOpened
(
r
)
}
// Close closes the FSRepo, releasing held resources.
func
(
r
*
FSRepo
)
Close
()
error
{
packageLock
.
Lock
()
defer
packageLock
.
Unlock
()
if
r
.
state
!=
opened
{
return
debugerror
.
Errorf
(
"repo is %s"
,
r
.
state
)
}
return
transitionToClosed
(
r
)
}
// Config returns the FSRepo's config. This method must not be called if the
// repo is not open.
//
...
...
@@ -253,17 +265,6 @@ func (r *FSRepo) SetConfigKey(key string, value interface{}) error {
return
r
.
setConfigUnsynced
(
conf
)
}
// Close closes the FSRepo, releasing held resources.
func
(
r
*
FSRepo
)
Close
()
error
{
packageLock
.
Lock
()
defer
packageLock
.
Unlock
()
if
r
.
state
!=
opened
{
return
debugerror
.
Errorf
(
"repo is %s"
,
r
.
state
)
}
return
transitionToClosed
(
r
)
}
var
_
io
.
Closer
=
&
FSRepo
{}
var
_
repo
.
Repo
=
&
FSRepo
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment