Skip to content

finish implementing Directory core API #3179

Closed

Description

@vito

I implemented the first parts of this API in #3168 but left a few parts unimplemented:

dagger/core/directory.go

Lines 209 to 228 in 03ea15e

func (s *directorySchema) Resolvers() router.Resolvers {
return router.Resolvers{
"DirectoryID": directoryIDResolver,
"Query": router.ObjectResolver{
"directory": router.ToResolver(s.directory),
},
"Directory": router.ObjectResolver{
"contents": router.ToResolver(s.contents),
"file": router.ToResolver(s.file),
"secret": router.ErrResolver(ErrNotImplementedYet),
"withNewFile": router.ToResolver(s.withNewFile),
"withCopiedFile": router.ToResolver(s.withCopiedFile),
"withoutFile": router.ErrResolver(ErrNotImplementedYet),
"directory": router.ToResolver(s.subdirectory),
"withDirectory": router.ToResolver(s.withDirectory),
"withoutDirectory": router.ErrResolver(ErrNotImplementedYet),
"diff": router.ErrResolver(ErrNotImplementedYet),
},
}
}

  • secret will need implement Secret core API #3178 first. can be removed from the schema per comments below
  • withoutFile might be a simple application of llb.Rm but I've never used that before.
  • withoutDirectory might be the same assuming llb.Rm is just placing a tombstone over a path and doesn't need to be done recursively.
  • diff is probably just llb.Diff of two directory states but I'm a little suspicious this might be more complicated with sub-directory paths. 🤔

Activity

  1. vito commented on Oct 6, 2022

    @vito
    ContributorAuthor

    @shykes Can we get rid of directory { secret(path: "foo") } since we already have this?:

    directory {
      file(path: "foo") {
        secret {
          id
        }
      }
    }

    The former is definitely more succinct, but thought I'd flag in case it's a relic of a prior iteration. 🙂

  2. shykes commented on Oct 6, 2022

    @shykes
    Contributor

    @shykes Can we get rid of directory { secret(path: "foo") } since we already have this?:

    directory {
    
      file(path: "foo") {
    
        secret {
    
          id
    
        }
    
      }
    
    }
    

    The former is definitely more succinct, but thought I'd flag in case it's a relic of a prior iteration. 🙂

    Good catch, yeah makes sense to get rid of it. Can't remember if we had already decided that but it makes sense to me now.

  3. self-assigned this
    on Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions