Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Klient/machine: start synchronization of stored mounts during KD initialization. - #10358

Merged
cihangir merged 7 commits into
masterfrom
machine_mount_machinegroup
Jan 23, 2017
Merged

Klient/machine: start synchronization of stored mounts during KD initialization.#10358
cihangir merged 7 commits into
masterfrom
machine_mount_machinegroup

Conversation

@ppknap

@ppknap ppknap commented Jan 19, 2017

Copy link
Copy Markdown
Contributor

Depends on: #10332

Code coverage: 50.3% of statements

How Has This Been Tested?

Unit tests.

Screenshots (if appropriate):

none

Types of changes

  • New feature (non-breaking change which adds functionality)

@codecov-io

codecov-io commented Jan 19, 2017

Copy link
Copy Markdown

Current coverage is 29.86% (diff: 0.00%)

Merging #10358 into master will decrease coverage by 0.01%

@@             master     #10358   diff @@
==========================================
  Files            93         93          
  Lines         11068      11075     +7   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           3308       3308          
- Misses         7417       7424     +7   
  Partials        343        343          

Powered by Codecov. Last update 6df933a...3755137

Comment thread go/src/koding/kites/config/cache.go Outdated
}

func KodingHome() string {
func KodingConfigHome() string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to rename it? The env is KODING_HOME so we can still treat it as KodingHome. Koding home directory stores also kd / klient data and cache, so it's not solely a config dir.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be happy to left this as is. I followed your guide to store cached data under:
$HOME/.cache/koding/*

but if you want I can create cache under:
$HOME/.config/koding/*
path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just nitpicking about the naming, as always. Having cache under ~/.cache is cool, nothing to do here. But there's no need to rename KodingHome because of it, that's was my point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted this change.


g.log.Info("Created alias for %s, %s", id, alias)
for _, id := range noAliases {
g.log.Warning("Missing alias for %v, regenerating...", id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%s

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use %s at L192 and L195 and here - %v.

// dynamicClient creates dynamic client functor that is used for mount sync
// connections.
func (g *Group) dynamicClient() mountsync.DynamicClientFunc {
return func(mountID mount.ID) (client.Client, error) {

@rjeczalik rjeczalik Jan 19, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for closure here. You can just define this method on Group:

func (g *Group) dynamicClient(id mount.ID) (client.Client, error) {

And then use method selector:

	syncOpts := mountsync.SyncOpts{
		ClientFunc: g.dynamicClient,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this approach to in order to make the purpose of this method explicit.

@cihangir

Copy link
Copy Markdown
Contributor

@ppknap we can rebase this now

hope someday @github will add "rebase" feature with one click

@ppknap
ppknap force-pushed the machine_mount_machinegroup branch from 8492302 to 5db6276 Compare January 20, 2017 15:10
atomic.AddInt64(&errN, 1)
g.log.Error("Cannot start synchronization for mount %s: %s", mountID, err)
}
}()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you pass mountID, m into go func() ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, you caught a nasty bug 💯

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extended tests to cover this case.

}

// mktree ensures that provided directory is created.
func mktree(dir string) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate code

@cihangir
cihangir merged commit 1dd3fd0 into master Jan 23, 2017
@cihangir
cihangir deleted the machine_mount_machinegroup branch January 23, 2017 09:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants