MCPcopy Create free account
hub / github.com/convox/rack / ObjectFetch

Method ObjectFetch

pkg/api/controllers.go:652–678  ·  view source on GitHub ↗
(c *stdapi.Context)

Source from the content-addressed store, hash-verified

650}
651
652func (s *Server) ObjectFetch(c *stdapi.Context) error {
653 if err := s.hook("ObjectFetchValidate", c); err != nil {
654 return err
655 }
656
657 app := c.Var("app")
658 key := c.Var("key")
659
660 v, err := s.provider(c).WithContext(c.Context()).ObjectFetch(app, key)
661 if err != nil {
662 return err
663 }
664
665 if c, ok := interface{}(v).(io.Closer); ok {
666 defer c.Close()
667 }
668
669 if _, err := io.Copy(c, v); err != nil {
670 return err
671 }
672
673 if vs, ok := interface{}(v).(Sortable); ok {
674 sort.Slice(v, vs.Less)
675 }
676
677 return nil
678}
679
680func (s *Server) ObjectList(c *stdapi.Context) error {
681 if err := s.hook("ObjectListValidate", c); err != nil {

Callers

nothing calls this directly

Calls 7

hookMethod · 0.95
providerMethod · 0.95
ContextMethod · 0.80
SliceMethod · 0.80
ObjectFetchMethod · 0.65
WithContextMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected