Skip to content

Commit

Permalink
CDPD-50020: [Ozone] Add ofsstat separately (#3189)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3a067c4)
(cherry picked from commit 045903b)
Change-Id: I49de9d2e91c83fd0a138d544062469a687d1546b
  • Loading branch information
Harshg999 authored and wing2fly committed Mar 16, 2023
1 parent 04a6290 commit 36a356c
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions desktop/core/src/desktop/lib/fs/ozone/ofsstat.py
@@ -0,0 +1,44 @@
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from builtins import oct
import math
import stat

from django.utils.encoding import smart_str

from hadoop.fs.hadoopfs import decode_fs_path
from hadoop.fs.webhdfs_types import WebHdfsStat

from desktop.lib.fs.ozone import join as ofs_join

class OzoneFSStat(WebHdfsStat):
"""
Information about a path in Ozone.
Modelled after org.apache.hadoop.fs.FileStatus
"""

def __init__(self, file_status, parent_path):
super(OzoneFSStat, self).__init__(file_status, parent_path)
self.path = ofs_join(parent_path, self.name)

def __unicode__(self):
return "[OzoneFSStat] %7s %8s %8s %12s %s%s" % (oct(self.mode), self.user, self.group, self.size, self.path, self.isDir and '/' or "")

def __repr__(self):
return smart_str("<OzoneFSStat %s>" % (self.path))

0 comments on commit 36a356c

Please sign in to comment.