Skip to content

Commit

Permalink
Update the API with the new partial metadata changes
Browse files Browse the repository at this point in the history
Signed-off-by: Enis Inan <[email protected]>
  • Loading branch information
ekinanp committed Jan 14, 2020
1 parent e4b5767 commit c16ab69
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api/fs/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ func newFSNode(finfo os.FileInfo, path string) fsnode {
}
n.
DisableDefaultCaching().
SetPartialMetadata(newFileInfo(finfo)).
Attributes().
SetMtime(finfo.ModTime()).
SetMode(finfo.Mode()).
SetSize(uint64(finfo.Size())).
SetMeta(plugin.ToJSONObject(newFileInfo(finfo)))
SetSize(uint64(finfo.Size()))
return n
}

Expand Down
1 change: 1 addition & 0 deletions api/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func toAPIEntry(e plugin.Entry) apitypes.Entry {
CName: plugin.CName(e),
Actions: plugin.SupportedActionsOf(e),
Attributes: plugin.Attributes(e),
Metadata: plugin.PartialMetadata(e),
}
}

Expand Down
1 change: 1 addition & 0 deletions api/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type entryList struct {
// Lists children of a path
//
// Returns a list of Entry objects describing children of the given path.
// The "metadata" key is set to the partial metadata.
//
// Produces:
// - application/json
Expand Down
1 change: 1 addition & 0 deletions api/types/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Entry struct {
Name string `json:"name"`
CName string `json:"cname"`
Attributes plugin.EntryAttributes `json:"attributes"`
Metadata plugin.JSONObject `json:"metadata"`
}

// Supports returns true if e supports the given action, false
Expand Down
12 changes: 6 additions & 6 deletions api/types/entrySchema.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,16 @@ func (s *EntrySchema) SetActions(actions []string) *EntrySchema {
return s
}

// MetaAttributeSchema returns the entry's meta attribute
// PartialMetadataSchema returns the entry's partial metadata
// schema
func (s *EntrySchema) MetaAttributeSchema() *plugin.JSONSchema {
return s.EntrySchema.MetaAttributeSchema
func (s *EntrySchema) PartialMetadataSchema() *plugin.JSONSchema {
return s.EntrySchema.PartialMetadataSchema
}

// SetMetaAttributeSchema sets the entry's meta attribute
// SetPartialMetadataSchema sets the entry's meta attribute
// schema to s. This should only be called by the tests
func (s *EntrySchema) SetMetaAttributeSchema(schema *plugin.JSONSchema) {
s.EntrySchema.MetaAttributeSchema = schema
func (s *EntrySchema) SetPartialMetadataSchema(schema *plugin.JSONSchema) {
s.EntrySchema.PartialMetadataSchema = schema
}

// MetadataSchema returns the entry's metadata schema
Expand Down

0 comments on commit c16ab69

Please sign in to comment.