src/server/pfs/server/obj_block_api_server.go
func (s *objBlockAPIServer) writeInternal(ctx context.Context, path string, data []byte) (retErr error) {
	defer func() {
		if retErr != nil {
			return
		}
		retErr = func() (retErr error) {
			if !s.objClient.Exists(ctx, path) {
				logrus.Errorf("%s doesn't exist after write", path)
				return fmt.Errorf("%s doesn't exist after write", path)
			}
			return nil
		}()
	}()
	w, err := s.objClient.Writer(ctx, path)
	if err != nil {
		return err
	}
	defer func() {
		if err := w.Close(); err != nil && retErr == nil {
			retErr = err
		}
	}()
	_, err = w.Write(data)
	return err
}
func (s *objBlockAPIServer) writeInternal(ctx context.Context, path string, data []byte) (retErr error) {
	defer func() {
		if retErr != nil {
			return
		}
		retErr = func() (retErr error) {
			if !s.objClient.Exists(ctx, path) {
				logrus.Errorf("%s doesn't exist after write", path)
				return fmt.Errorf("%s doesn't exist after write", path)
			}
			return nil
		}()
	}()
	w, err := s.objClient.Writer(ctx, path)
	if err != nil {
		return err
	}
	defer func() {
		if err := w.Close(); err != nil && retErr == nil {
			retErr = err
		}
	}()
	_, err = w.Write(data)
	return err
}
func ( s * objBlockAPIServer ) writeInternal ( ctx context . Context , path string , data [ ] byte ) ( retErr error ) { defer func ( ) { if retErr != nil { return } retErr = func ( ) ( retErr error ) { if ! s . objClient . Exists ( ctx , path ) { logrus . Errorf ( " " , path ) return fmt . Errorf ( " " , path ) } return nil } ( ) } ( ) w , err := s . objClient . Writer ( ctx , path ) if err != nil { return err } defer func ( ) { if err := w . Close ( ) ; err != nil && retErr == nil { retErr = err } } ( ) _ , err = w . Write ( data ) return err }
// writeInternal contains the essential implementation of writeProto ('data' is
// a serialized proto), but does not retry
writeInternal contains the essential implementation of writeProto ( data is a serialized proto ) but does not retry